I have a mysql table like this
PRODUCT
-------
product_id: 1 | name: product .... product_id: 2 | name: product2 .. etc etc
then i have another table
PROPERTY
---
id: 1 | name: red | product_id: 1 .... id: 2 | name: large | product_id: 1 ..... id: 3 | name : brown | product_id: 2 .... and so on ...
How can i select a product with 2 property?
For example i want to take a product with RED and LARGE property
i tried
SELECT * FROM product
JOIN property USING (product_id)
WHERE property.name = "red" AND property.name = "large" ....
but obviusly it doesn’t work 🙂
thanks for the help and sorry for my english!
you need to count its instances of its record
if you click the demo, you can see the differences between grouping the result and by regular filetering using
INSQLFiddle Demo