Answer the question
In order to leave comments, you need to log in
How to make the right choice?
There are 3 tables products and properties and property_values
​​The products table has id, title, price
fields The properties table has id, title fields The property_values ​​table has id,
product_id
, property_id, value fields
values, that is something like this
select * from products left join property_values on products.id = property_values.product_id where property_values.property_id = property_id_1 AND property_values.value = value_1 AND property_values.property_id = property_id_2 AND property_values.value = value_2
Answer the question
In order to leave comments, you need to log in
SELECT product.*, properties.title, values.value
FROM products
JOIN property_values values ON values.product_id = product.id
JOIN properties ON properties.id = values.property_id
WHERE values.property_id IN (......)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question