•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 397,816 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,594 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 726 | Replies: 0
![]() |
•
•
Join Date: May 2006
Location: Calpines, California
Posts: 25
Reputation:
Rep Power: 3
Solved Threads: 1
I have the following select query:
However, I need to add to the query the following:
I only want to select jobids that have images with tags from every tag category that the list of tags has. For example, if the taglist has 5 tagids (34, 56, 57, 67, 88) and tagids 34,56 have tagcatid 2, 57 has tagcatid 5, and 67 and 88 have tagcatid 8, then the jobids must have imageids with tagids that have a tagcatid from all three of these categories.
SELECT DISTINCT Job.JobID, Job.DateAdded FROM Job, ImageTag, Image, Tag, TagCat WHERE TagCat.TagCatID = Tag.TagCatID AND Tag.TagID = ImageTag.TagID AND ImageTag.JobID = Image.ImageID AND Image.JobID = Job.JobID AND ImageTag.TagID IN (#TagIDList#) ORDER BY Job.DateAdded DESC
However, I need to add to the query the following:
I only want to select jobids that have images with tags from every tag category that the list of tags has. For example, if the taglist has 5 tagids (34, 56, 57, 67, 88) and tagids 34,56 have tagcatid 2, 57 has tagcatid 5, and 67 and 88 have tagcatid 8, then the jobids must have imageids with tagids that have a tagcatid from all three of these categories.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MS SQL Marketplace
- sql query problem with MS Access and C# (C#)
- database connection(select ,insert query) within javascript function (JSP)
- Select Query Problem in access (MS Access and FileMaker Pro)
- Problems in QUERY (Visual Basic 4 / 5 / 6)
- member group query (MySQL)
- hav a problem with this query (MySQL)
Other Threads in the MS SQL Forum
- Previous Thread: Must declare the scalar variables in storedprocedure in sql 2005
- Next Thread: Trigger help


Linear Mode