Reputation: 9003
I'm sure this question is fairly simple, but I am not very savvy when it comes to SQL queries. Here is an example table:
|Name |N|
--------
|Mike |1|
|John |2|
|Dave |3|
|Jane |1|
|Kyle |2|
|Susan |4|
|Tim |5|
|Joe |5|
|Tina |7|
|Carly |1|
I need to select all 'N' from this table that occurs only once. The result for this table should be 3, 4, and 7.
Upvotes: 0
Views: 116
Reputation: 18002
SELECT distinct(N) FROM table_name;
Or am I missing the point?
Upvotes: 0
Reputation: 238086
You can use a having
clause for that:
select n
from YourTable
group by
n
having count(*) = 1
Upvotes: 4