SQL query to list cities in which employee did not work from below "employee" table:
| name | city |
|---|---|
| srini | seattle |
| ross | atlanta |
| rich | redmond |
Example: if I give "srini", query should return "Atlanta" and "Redmond"
I tried below 2 queries with no luck, it returns empty results:
-
SELECT t1.city FROM employee t1 JOIN employee t2 ON t1.name=t2.name WHERE t1.city != t2.city WHERE name='srini' -
SELECT city FROM (SELECT city FROM employee WHERE name='srini') as e1 WHERE city <> e1.city