SELECT DISTINCT MonthName(Month([Date])) AS [Month], tblSupportCalls.System, Count(tblSupportCalls.System) AS [Total for System], Year([Date]) AS [Year]
FROM tblSupportCalls
WHERE (((tblSupportCalls.Date) Between Now() And Now()-7) AND ((tblSupportCalls.System) In ('Career Campus','E-PEEP')) AND ((tblSupportCalls.StartTime) Is Not Null) AND ((Hour([StartTime]))>=7))
GROUP BY tblSupportCalls.System, tblSupportCalls.Date;
每当我输入它给我多个月时间:
July
July
July
我只想说7月只有一次,我无法弄清楚为什么田野在不同的日子里重复着。我只是想说:
MONTH |系统|总系统|年
我正在看的是
> MONTH | System | Total Systems | Year
> July CC 2 2010
> July CC 7 2010
> July CC 9 2010
> July EE 1 2010
> July EE 2 2010
需要:
MONTH | System | Total Systems | Year
July CC 18 2010
July EE 03 2010
答案 0 :(得分:3)
您希望按年份和月份进行分组,而不是tblSupportCalls.Date
。
...
GROUP BY tblSupportCalls.System, Year([Date]), Month([Date]);
答案 1 :(得分:1)
您仍然按日期对结果进行分组(不是按月)。我想你想要的是这样的:
GROUP BY tblSupportCalls.System, Year ([tblSupportCalls.Date]), [Month([tblSupportCalls.Date]);
我认为您仍然希望按年份分组,因此2010年7月显示与2011年7月不同。