Mysql join query for multiple "tags" (many-to-many relationship) that matches ALL tags?
Use:
SELECT *
FROM OBJECTS o
JOIN OBJECTSTAGS ot ON ot.object_id = o.id
JOIN TAGS t ON t.id = ot.tag_id
WHERE t.name IN ('tag1','tag2')
GROUP BY o.id
HAVING COUNT(DISTINCT t.name) = 2
You were missing the HAVING clause.
There's no need to LEFT JOIN if you want only rows where both tags exist.