I have a table with 4 columns: id, A, B, C. I need to select A based on B and C.
B is a filter and has integer values, C are the filter options, also integer.
I tried this:
SELECT a FROM table WHERE (b=1 AND c IN (5,6,7)) AND (b=2 AND c IN (9,10,11))
But that doesn't work because B can't be 1 and 2 at the same time. I tried with OR:
SELECT a FROM table WHERE (b=1 AND c IN (5,6,7)) OR (b=2 AND c IN (9,10,11))
This returns A but wrong... I need both conditions to be correct.
How can I make this query work?
Thank you!