Mysql join query for multiple “tags” (many-to-many relationship) that matches ALL tags?
问题 I am trying to query for Objects that match ALL of a given set of Tags. Basically I want users to be able to add on more and more Tags to filter or "narrow down" their search results, kind of like newegg.com does. My table structure is a table of Objects, a table of Tags, and a MANY:MANY relation table ObjectsTags. So I have a JOIN query like so: SELECT * FROM Objects LEFT OUTER JOIN ObjectsTags ON (Objects.id=ObjectsTags.object_id) LEFT OUTER JOIN Tags ON (Tags.id=ObjectsTags.tag_id) I tried