Need some help with this.
3 tables - Tag_Table, Media_Table, TagXMedia_Table
TagID is primary key of Tag_Table and foreign key in TagXMedia_Table
MediaID is a primary key of MediaTable and a foreign key of TagXMedia_Table
So i can have multiple tags reference multiple media items.
What i want to be able to do is select all the mediaId's from the TagXMedia_Table which have a TagId of x AND x AND x etc
So I am trying to select single MediaID's which have all of the given TagIds - like an AND select statement but accross the rows. I cant do the simple select * from TagXMedia_Table where TagID=1 AND TagID=2 for example as i have actually got:
TagID | MediaID
1 | 40
1 | 59
2 | 40
and i want to return 40 in this case.
Hope this makes some sense.