用SQL实现取员工日工作量和月工作量
用SQL实现取员工日工作量和月工作量
SELECT CONVERT(char(10), 时间, 120) AS 时间, COUNT(1) AS 日工作量
FROM (SELECT DISTINCT BookID, CreatedDate AS 时间, CreatedByUser AS 姓名
FROM BWK_120BookIn
UNION
SELECT DISTINCT BookID, CreatedDate, CreatedByUser
FROM BWK_120BookIn ) AS t
GROUP BY CONVERT(char(10), 时间, 120)
ORDER BY 时间
select count(*) as 工作量,datename(MM,Createddate) 月 from bwk_120bookin group by datename(MM,Createddate)
GO