Let's say I have a table making a junction between two tables... like this:
id_product | id_category
-----------------
11 | 22
11 | 33
12 | 22
12 | 33
I want to get id_products (distinct) according to a list of searched categories IDs.
If I use the IN() clause, the list of id_categories uses a logical OR.
How can I make a SELECT query to have logical ANDs for the list of id_categ submitted??
Example: I want all the id_products belonging to category 22 AND 33 (and possibly 5+ more Categ. IDs)
I found this answer: Using MySQL IN clause as all inclusive (AND instead of OR) ...but the query is mixing more than 1 table... I only want a query on a single table, the junction one.