开发者

Need help on a SQL select query in MS Access

I'm sure this question is fair开发者_Go百科ly 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.


You can use a having clause for that:

select  n
from    YourTable
group by
        n
having  count(*) = 1


SELECT distinct(N) FROM table_name;

Or am I missing the point?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜