我已经编写了以下查询来显示一周中各个日子的总呼叫(来自电话系统)。我现在需要的是显示这些天来的总呼叫数的平均值。
我的查询如下:
SELECT WeekdayName(Weekday([Calls Volume].Weekday),False,1) AS [Day of the week], Sum([Calls Volume].Offered) AS [Calls Offered]
FROM [Calls Volume]
GROUP BY WeekdayName(Weekday([Calls Volume].Weekday),False,1), [Calls Volume].Weekday
ORDER BY [Calls Volume].Weekday;
当前输出:
Day of the week | Calls Offered
--------------------------------
Monday | 100
Tuesday | 200
Wednesday | 300
期望的输出:
Day of the week | Calls Offered | Average Calls for the day of the week
-------------------------------------------------------------------------
Monday | 100 | 30
Tuesday | 200 | 20
Wednesday | 300 | 15
由于 样本数据:
DateTime | Calls Offered
------------------------
1/08/2014 9AM | 12
1/08/2014 10AM | 10
2/08/2014 9AM | 9
2/08/2014 11AM | 12
依此类推......