I'm sure this is simple but my brain just isnt working today!
I have a table products, lets just assume it contains p_id, i have another table - a pivot table - which references between products and another table attributes, this table is products_to_attributes and contains pta_aid (attribute id) and pta_pid (product id)
Hopefully this (incorrect) query will show what i want to do better than i can explain it:
SELECT `p_id` FROM `products`
LEFT JOIN `products_to_attributes` ON (`pta_pid` = `p_id`)
WHERE ((`pta_aid` = '1' OR `pta_aid` = '2') AND(`pta_aid` = '3'))
I want to be able to group together attributes where a product must have attribute 1 Or attribute 2 AND have attribute 3.