I found out what was wrong.
products.id = 2
should be
products.master = 2
Hello again.
Got the problem you referred to earlier.
The count should be the same value as the number of options. Note that in order to get this to work the combination of product_id and option_id should be unique.
The table "Products" actually also have a "master" field that referers to all products that are "slaves":
ID Name master
01 T-shirt 0
02 Cardigan (slave) 3
03 Cardigan (master) 0
So theroetically I can narrow down the query by adding JOIN or something so the query you suggested would be unique.
I tried this with no luck:
SELECT products.id AS pid,options_to_products.product_id AS oppid
FROM products,options_to_products
WHERE products.id = options_to_products.product_id AND products.id = 2 AND options_to_products.option_id IN (2, 4)
GROUP BY options_to_products.product_id
HAVING count(options_to_products.product_id) = 2