For following table data:
ID | Property
=================
1 | Sweet
2 | Sweet
2 | Sour
3 | Hot
How can I get the ID's having Property
Sweet AND Sour (in this example, 2)
Thanks.
The easiest way would be group by
and having
select
ID from table_name
where Property in('Sweet','Sour')
group by ID
having count(*)=2