I’ve got the database with 3 tables:
product (id, name, price, ...)
product_option (id, product_id, option_id)
option (id, value)
products have many options
For example I need to find a product with option A and option B and not a product with just an option A.
I’m using somethink like this:
select * from product
left join product_option on product_option.product_id = product_id
where product_option.option_id in (1,2,3)
and product_option.option_id in (4)
group by product.id
Of course the result is always empty.
I need those products with option_id (1 or 2 or 3) and 4
How can I do that?
as you want two difrent matches, you need to join the product_option twise