我想要多个日期时间的总和值。
代码
SELECT cs.EmployeeRun, cs.Date, cs.Total, SUM(cs.Total) as Sum
FROM CusSalaryDay cs
WHERE cs.Date Between '2012-12-03' and '2012-12-05'
GROUP BY cs.EmployeeRun, cs.Date, cs.Total
Order By EmployeeRun,Date
输出
EmployeeRun | Date | Total | Sum
2330005 | 2012-12-03 00:00:00.000 | 600 | 600
2330005 | 2012-12-04 00:00:00.000 | 600 | 600
2330005 | 2012-12-05 00:00:00.000 | 0 | 0
3467951 | 2012-12-03 00:00:00.000 | 600 | 600
3467951 | 2012-12-04 00:00:00.000 | 600 | 600
3467951 | 2012-12-05 00:00:00.000 | 480 | 480
但我需要输出
EmployeeRun | Date | Sum
2330005 | 2012-12-03 - 2012-12-05 | 1200
3467951 | 2012-12-03 - 2012-12-05 | 1680
谢谢你的时间。:)