|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ok here is the table structure I have:
picture picID filename etc. picsubject picID subjectID subject subjectID subjectname etc. Say one picID (01) has more than one subject listed in the picsubject table. I would place the data in more than one row as such: picID subjectID 01 10 01 11 How would you perform a query that finds the picID that contains a subjectID of both 10 and 11? Anybody have any suggestions? Thanks |
|
#2
|
|||
|
|||
|
SELECT [picsubject].[picID], Count([picsubject].[subjectID]) AS CountOfsubjectID
FROM picsubject WHERE ((([picsubject].[subjectID])="10" Or ([picsubject].[subjectID])="11")) GROUP BY [picsubject].[picID] HAVING (((Count(picsubject.subjectID))=2)); s- |
|
#3
|
|||
|
|||
|
Thanks man it worked.
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Many-to-Many query with multiple conditions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|