I need to build a query that queries products based on multiple categories.
A product can have multiple categories attached to it and I want to query products that are only in ALL of the selected categories.
My query might look like:
SELECT * FROM products INNER JOIN products_categories.productid = products.productid WHERE products_categories.categoryid IN (1,5,13)
The results I want is for the products that are returned would be in ALL three categories, 1, 5, and 13, however, that query would return products that were in ANY of those categories.
How can I alter this query to have the desired results? Thank you in advance!