Answer the question
In order to leave comments, you need to log in
How to create the right lookup query?
There are 3 tables product, property and product_property. products are related to property through the product_property intermediate table.
How to choose the right products from product that would match multiple property.id?
SELECT * FROM `product`
left join `product_property` ON `product_property`.product_id=`product`.id
WHERE (product.category_id=4625415)
AND (product_property.property_id=20)
AND (product_property.property_id=1)
AND (product_property.property_id=5)
Answer the question
In order to leave comments, you need to log in
Perhaps your script is included in the head and simply does not see h4. Because the script is quite working
Sample.
SELECT product.id
FROM product
INNER JOIN product_property
INNER JOIN property
WHERE property.value IN ( {values list} )
GROUP BY product.id
HAVING COUNT(DISTINCT property.value) = {distinct values count}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question