I'm stuck trying to solve a problem that's proving to be more difficult than it seems.
Consider there is a table that associates products with attributes, it looks like this:
Products_id | Attribute_id 21 | 456 21 | 231 21 | 26 22 | 456 22 | 26 22 | 116 23 | 116 23 | 231
Next, I have a list of attribute_ids which I want to use in order to get the products that have all the attributes in that list.
For example if I search in the table above using this list (456, 26) I should get these product_ids 21 and 22. Another example, if I search for (116, 231) I should get 23 since the product 23 is the only on that has both these attributes.
How can I achieve this using one query?
I hope I made my question clear.
Thanks.