Hi list,
I have three tables:
product (ID, name)
product2attribute (ID, product, attribute)
attribute (ID, name)
Product <-> Attribute is an n:m relation, so one product can have two or
more attributes and of course there can be many products with an attribute.
I want to select alle products that have attribute A and attribute B.
The only query that came to my mind was something like SELECT * FROM product
WHERE EXISTS (SELECT * FROM product2attribute WHERE attribute = ...) AND
EXISTS (SELECT * FROM product2attribute WHERE attribute = ...).
Is this the correct and only query to accomplish that?
Regards,
André
| Thread |
|---|
| • AND-conjunction of rows | André Hänsel | 11 Oct |