Access(SQL)-计算不同的字段并按字段名称分组 [英] Access(SQL) - Count distinct fields and group by field name
本文介绍了Access(SQL)-计算不同的字段并按字段名称分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正处于使客户端成为Access数据库的中间,并且一直坚持如何解决即时通讯问题.
I am in the middle of making a Client a Access Database and am stuck on how to work around what im doing.
我有一张桌子,上面有东西 我有一张叫观察的桌子,像这样
i have a table with somthing like i have a table called Observations with somithing like this
Error Identified | Error Cat | ... | So on
No | | |
Yes | Dave3 | |
Yes | Dave | |
Yes | Dave3 | |
Yes | Dave5 | |
Yes | Dave | |
Yes | Dave6 | |
Yes | Dave6 | |
Yes | Dave | |
我要计算每个[错误类别]为[是]的[错误类别]的出现次数
I want to count the number of occurrences that each [Error Cat] where [Error Identified] is yes
所以会bb
Error Cat | Count |
Dave | 3 |
Dave3 | 2 |
Dave5 | 1 |
Dave6 | 2 |
发生这种情况的Access SQL是什么
What is the Access SQL for this to happen
我尽力了,但是却无法运行SQL 请帮忙.
I tried so hard but it just wont run the SQL Please help.
推荐答案
SELECT ErrorCat, COUNT(*) totalCount
FROM tableName
WHERE ErrorIdentified = 'YES'
GROUP BY ErrorCat
这篇关于Access(SQL)-计算不同的字段并按字段名称分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文