I have table test
contain 4 fields
+----+-----------+--------------+-----+
| id | int_value | string_value | qid |
+----+-----------+--------------+-----+
| 1 | 111 | Red | 1 |
| 2 | 111 | Green | 2 |
| 3 | 111 | Blue | 3 |
| 4 | 222 | Yellow | 1 |
| 5 | 222 | Red | 2 |
| 6 | 333 | Red | 1 |
| 7 | 333 | Green | 2 |
+----+-----------+--------------+-----+
I want to query int_value
that match flowing constraints.
(qid = 1 and string_value = 'Red') and (qid = 2 and string_value = "Green")
The result could be 111
and 333
It's not make sense if I apply this statement
select int_value from test
where (qid = 1 and string_value = 'Red')
and (qid = 2 and string_value = "Green")
Does one can help me?
Thank you.