[英]Need help on a SQL select query in MS Access
I'm sure this question is fairly simple, but I am not very savvy when it comes to SQL queries. 我敢肯定,这个问题很简单,但是对于SQL查询,我并不很精明。 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. 我需要从该表中选择仅出现一次的所有“ N”。 The result for this table should be 3, 4, and 7.
该表的结果应为3、4和7。
You can use a having
clause for that: 您可以为此使用
having
子句:
select n
from YourTable
group by
n
having count(*) = 1
SELECT distinct(N) FROM table_name; 从table_name中选择distinct(N);
Or am I missing the point? 还是我错过了重点?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.