I am trying to make my keyword search as efficient as possible using the following 3 tables :
tblImageFiles [ID, ImageURL]
tblTags [ID,Tag]
tblxImagesTags [ID, ImageID, TagID] (this is a linktable joining the above in a many-to-many relationship)
Can anyone help me out with a stored procedure to return ALL images which match ALL search tags entered based on this schema?
Thanks
The number in the
count(distinct aux.TagID)
must be equal to the number of tags inwhere t.Tag in (tag1, tag2, tag3)
.