Du kan finde artikler med bestemte kategorier ved at gruppere og sammenligne en samlet liste:
SELECT a.id, a.other_stuff
FROM articles a
JOIN article_category ac ON ac.article_id = a.id
GROUP BY a.id
HAVING GROUP_CONCAT(DISTINCT ac.category_id ORDER BY ac.category_id SEPARATOR ',') = '1,2'Ved at ændre strengen til fx '1,2,7' kan du søge i flere kategorier uden at ændre selve forespørgslen.