Hi all,
I have the table below.
+--------+---------+-------------+--------------------------------+-------+----+
| parent | country | city | hotel | stars | id |
+--------+---------+-------------+--------------------------------+-------+----+
| 1 | AE | Dubai | Emirates Towers | 5 | 1 |
| 1 | AE | Khor Fakkan | Le Meridien Al Aqa Beach Resor | 5 | 2 |
| 2 | TR | Antalya | Rixos | 5 | 3 |
| 2 | IR | Tehran | Esteghlal | 5 | 4 |
| 3 | TR | Antalya | Laress Park | 5 | 5 |
+--------+---------+-------------+--------------------------------+-------+----+
I want to query the db such that it selects all parents whose associated countries are TR AND IR. in other words I want to find the parent(s) that necessarily include both TR and IR. in this example the result would be 2 since
parents 1 and 3 do not include both TR AND IR.
using INTERSECT:
i think this can be done easily using INTERSECT(havent tried it thouh)
select parent from destinations where country='IR'
INTERSECT
select parent from destinations where country='TR';
any ideas as to whats the equivalent for the above query in mysql?