I have a table named foobar with columns name and location. I want use SQL to get all the names of people that have been to New York but have not been to San Francisco.
So far have:
select name
from foobar
where location = "New York" and location != "San Francisco"
group by name
You could also do this with a LEFT JOIN: