MS Access-Show Occurence Count [英] MS Access-Show Occurence Count
问题描述
嗨
我是Access新手。我想知道如何构建一个查询,它将显示一列中每个不同条目的出现次数?
示例
SNo州
1佛罗里达州
2加州
3佛罗里达州
4佛罗里达州
5华盛顿
佛罗里达州
我希望查询返回
Florida-4 >
California-1
华盛顿-1
请帮忙!我需要尽快完成这项工作!!
谢谢
Hi
I am new to Access. I want to know how to build a query that will
display an occurrence count of each distinct entry in a column?
Example
SNo State
1 Florida
2 California
3 Florida
4 Florida
5 Washington
6 Florida
I want the Query to Return
Florida-4
California-1
Washington -1
Please help! I need to get this done soon!!
Thanks
推荐答案
su ********** @ gmail.com 写道:
嗨>
我是Access的新手。我想知道如何构建一个查询来显示列中每个不同条目的出现次数?
示例
SNo状态
1佛罗里达州
2加州
3佛罗里达州
4佛罗里达州
5华盛顿
6佛罗里达州
我希望查询返回
佛罗里达-4 -
加州-1
华盛顿-1
请帮忙!我需要尽快完成这项工作!!
谢谢
Hi
I am new to Access. I want to know how to build a query that will
display an occurrence count of each distinct entry in a column?
Example
SNo State
1 Florida
2 California
3 Florida
4 Florida
5 Washington
6 Florida
I want the Query to Return
Florida-4
California-1
Washington -1
Please help! I need to get this done soon!!
Thanks
SELECT DISTINCT State& '' - ''& (SELECT Count(A.State)AS发生
tblSNo AS A WHERE A.State = tblSNo.State)AS MyOutput FROM tblSNo;
MyOutput < br $> b $ b加利福尼亚州1
佛罗里达州-4
华盛顿-1
很快?
James A. Forutne
SELECT DISTINCT State & ''-'' & (SELECT Count(A.State) AS Occurs FROM
tblSNo AS A WHERE A.State = tblSNo.State) AS MyOutput FROM tblSNo;
MyOutput
California-1
Florida-4
Washington-1
Soon enough?
James A. Forutne
非常感谢詹姆斯,请原谅我的无知,但你能不能告诉我我是怎样的? />
把它放入访问查询中?它从SELECT开始,它会抛出一个
错误
Thanks a lot James, forgive my ignorance, but could you tell me how i
put this into an access query? It starts with SELECT, and it throws an
error
su ********** @ gmail.com 写道:
非常感谢詹姆斯,请原谅我的无知,但是你能告诉我怎么把它放到访问查询中吗?它以SELECT开头,它会抛出一个
错误
Thanks a lot James, forgive my ignorance, but could you tell me how i
put this into an access query? It starts with SELECT, and it throws an
error
您也可以尝试:
SELECT状态和放大器; '' - ''& (SELECT Count(A.State)FROM tblSNo AS A WHERE
A.State = tblSNo.State)AS MyOutput FROM tblSNo GROUP BY State;
You表可能有不同的名称。确保上面的''tblSNo''出现的每个
都被您的表名替换。另外,
确保表中的字段命名为State。
将SQL文本粘贴到查询的SQL视图中。
James A. Forutne
You can also try:
SELECT State & ''-'' & (SELECT Count(A.State) FROM tblSNo AS A WHERE
A.State = tblSNo.State) AS MyOutput FROM tblSNo GROUP BY State;
You probably have a different name for the table. Make sure that each
occurrence of ''tblSNo'' above is replaced by your table name. Plus,
make sure the field in your table is named State.
Paste the SQL text into the SQL View for the query.
James A. Forutne
这篇关于MS Access-Show Occurence Count的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!