我必须检索在两个日期范围内有多少员工参加工作。我设法得到这样的查询
前日期范围:2012-02-03
至2012-03-03
SELECT A.EmployeeD, A.EmployeeName, ISNULL(SUM(CASE WHEN a.AttendanceDate BETWEEN '2012-02-03' AND '2012-03-03' THEN 1 ELSE 0 END), 0) AS AttendCount
FROM (SELECT EmployeeID, EmployeeName, AttendanceDate
FROM dbo.tblAttendance
GROUP BY EMPLOYEEID, EmployeeName, AttendanceDate
) AS A
GROUP BY EMPLOYEEID, EmployeeName
但是我该如何使用它才能在 Crystal Report(在 C# 上)上显示它?我的意思是,我希望用户能够更改程序内的日期范围。
我通常将select expert
功能用于此类事情,但据我所知,我认为这不会起作用...有人可以帮助我吗?提前致谢 :)