使用Count()访问查询

时间:2014-04-16 14:40:28

标签: sql ms-access count

(Access 2010)

有人能说出第2列和第3列检索完全相同数字的原因吗? (他们不应该 - 不同的条件,因此不同的记录数量)

看不出有什么问题......

SELECT tblAssssDB.[Division:], Count(([Mod New Outcome]="SELF EMPLOYED" And [ET Outcome]="GREY AREA")) AS [Undecided to Self-employed], Count(([Mod New Outcome]="EMPLOYED" And [ET Outcome]="GREY AREA")) AS [Undecided to Employed], Count(([Mod New Outcome]="SELF EMPLOYED" And [tblAssssDB].[ET Outcome]="EMPLOYED")) AS [Employed to Self-Employed], Count((IsNull([ET Outcome] And [ET Outcome]=[Mod New Outcome]))) AS [No change in Outcome]
FROM tblAssssDB
WHERE (((tblAssssDB.[ET Comment]) Is Not Null))
GROUP BY tblAssssDB.[Division:];

帮助!!

1 个答案:

答案 0 :(得分:3)

计数并不是真的可以用来为您提供一定数量的具体结果。我认为使用类似的东西可以更好地服务

SUM(IIF(critiera, 1, 0))