Count([Table] .Field),Where([Table] .Field = Variable)不返回零(0)

时间:2018-06-16 00:06:01

标签: ms-access

我有一张表格,其中包含对多项选择调查的回复。

表格中的字段为:[ID] [TERM] [INSTRUCTOR] [CRN] [Q01] [Q02]...[Q24]

每行/记录代表个人对一组24个多项选择题的回答(回复记录为变量[A, B, C, D, E, N])。 Example of table layout

我需要查询每个教师和课程编号(CRN)为每个问题选择的每个响应的数量(A-N)。 Example of Desired Output

我可以编写一个查询,计算每个教师所包含的每个响应,一次一个问题(字段),但如果完成调查的人没有选择给定的字母,则不会返回零(0)。

我确实尝试了Nz(COUNT([TABLE].FIELD),0),但是如果没有什么可以计算的话,那么甚至不能将NULL作为零返回。

SELECT [Department Question List].[Question Number], [Dept Eval Responses].INSTRUCTOR, 
    [Dept Eval Responses].[BANNER TERM], [Dept Eval Responses].CRN, 
    [Dept Eval Responses].Q01_Response AS RESPONSE, 
    Count([Dept Eval Responses].Q01_Response) AS [RESPONSE COUNT]
FROM [Department Question List], [Dept Eval Responses]
WHERE ((([Department Question List].[Question Number])="Q01"))
GROUP BY [Department Question List].[Question Number], 
    [Dept Eval Responses].INSTRUCTOR, [Dept Eval Responses].[BANNER TERM],
    [Dept Eval Responses].COURSE, [Dept Eval Responses].SECTION, [Dept Eval Responses].CRN, 
    [Dept Eval Responses].Q01_Response
ORDER BY [Dept Eval Responses].INSTRUCTOR, [Dept Eval Responses].[BANNER TERM],
    [Dept Eval Responses].COURSE, [Dept Eval Responses].SECTION, 
    [Dept Eval Responses].Q01_Response;

0 个答案:

没有答案