【发布时间】:2017-10-26 12:31:53
【问题描述】:
我在 MS Access 2013 数据库中有以下查询,该查询选择了过去 7 天内日期的所有记录的计数:
SELECT DateValue([Proofpoint Attachment Defense.Received]) AS [Date],
Count([Proofpoint Attachment Defense.Received]) AS [count]
FROM [Proofpoint Attachment Defense]
WHERE ((([Proofpoint Attachment Defense.Received])>=DateAdd("d",-7,Date())))
GROUP BY DateValue([Proofpoint Attachment Defense.Received])
此查询产生以下结果:
Date count
10/19/2017 3
10/20/2017 2
10/25/2017 3
即使没有结果,我需要的结果也必须包括所有 7 个日期:
Date count
10/19/2017 3
10/20/2017 2
10/21/2017 0
10/22/2017 0
10/23/2017 0
10/24/2017 0
10/25/2017 3
【问题讨论】:
标签: sql ms-access ms-access-2013