Answer the question
In order to leave comments, you need to log in
Is it possible to get this result in one query?
There are tables:
product_features (product_id, feature_id, feature_value_id) - product characteristics
feature_values (id, feature_id, value) - feature values
The product has 3 features, we know only their ID (feature_id)
Question: is it possible with one request ( without selecting characteristics by subqueries or somehow minimizing them) to pull out the values of characteristics of goods?
Answer the question
In order to leave comments, you need to log in
In SQL, this operation is called LEFT JOIN .
SELECT product_features.feature_id, feature_values.value
FROM product_features
LEFT JOIN feature_values ON feature_values.id = product_features.feature_value_id
WHERE product_features.feature_id IN (1,2,3) AND product_features.product_id = 1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question