I have a table as below:
Here, I wanna run a query which looks like this:
SELECT model_id
FROM model_attributes
WHERE ((attributes_id=2 and attributes_value='32mb')) AND ((attributes_id=4 AND attributes_value='5.00 inch') OR (attributes_id=4 and attributes_value='6.00 inch')) AND ((attributes_id=5 and attributes_value='here') OR (attributes_id=5 and attributes_value='asfdsdf'))
which returns model_ids 8, 9
. But it seems like I can't put multiple conditions in the same fields.
I also tried solutions in this post still nothing ! How can I get this result ? The way I used the AND
clause is incorrect but resembles what logic I wanna implement in the query.