Sergey_S wrote:
I have the table:
ID condition_id property_id 1 c_3 b_1 2 c_13 b_2 3 c_3 b_4 4 c_13 b_1 5 c_3 b_2 6 c_4 b_1
I need to select all properties with condition_id c_3 and c_13 not just c_3 or c_13 (I expect in the result it should be only b_1 and b_2)
The query like this:
SELECT *
FROM table
WHERE condition_id IN ( 3,13 )
A simple way to do it is:
SELECT *
FROM table
WHERE condition_id IN ('c_3') AND property_id IN (SELECT property_id FROM table WHERE condition_id IN ('c_13'))