I have a example scenario, where I have a table with 3 columns which are
feature_id
value
product
I want to get all the products where feature_id is 1 or 3 and value is "Yes". Following query in sql give me empty result set
SELECT * FROM product
WHERE
(feature_id = 1 AND Value = "Yes")
AND
(feature_id = 3 AND Value = "Yes")
Table image is also attached:
2
Answers
In your current syntax feature_id needs to be both 1 and 3 at the same time, which is impossible. You need to change
AND
toOR
:Or better:
you can make a combination of OR and AND