This has got to be a common thing, but I'm not having luck Googling around.
I have a table of categories:
Table A
catid | text
1 | Category A
2 | Category B
3 | Category C
This table is then joined to a map that keeps track of what categories a photo is in
Table B
catid | photoid
1 | 1
2 | 1
1 | 2
3 | 3
What I need to do is filter the query so that I return only the photos that are in EVERY category selected. For example:
- If the user selects categories A and B, I return photo 1.
- If the user selects just category A, I return photos 1 and 2.
- If the user selects categories A,B and C - I return nothing.
Thanks for any help you can give.
-Matt