Reputation: 931
I Have the following table.
id NAME folder_NAME
1 tom popular
2 tom folder2
3 peter popular
4 peter folder1
5 john folder1
6 john folder2
7 john folder3
8 Mark folder1
9 Mark folder2
10 Alex folder1
How do I select the names that do not have a folder name 'popular' ?
Upvotes: 0
Views: 84
Reputation: 691
Try this:
select distinct NAME
from table
where name not in (select name from table where folder_name = 'popular')
but this is not the best query, which could be written. I would prefer here NOT EXISTS clause.
Upvotes: 2