MySQL left join where 2nd object is AND is

The table tags is not needed.
Join products to products_tags, group by product and set the condition in the HAVING clause:

SELECT p.id, p.name 
FROM products p INNER JOIN products_tags p_t 
ON p_t.product_id = p.id
GROUP BY p.id, p.name
HAVING COUNT(*) >= 2

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top