按月份统计工时

SELECT p.`name`,YEAR(p.beginTime) AS Y,MONTH(p.beginTime) AS M ,COUNT(p.name) AS days,SUM(TIMESTAMPDIFF(HOUR,p.beginTime,p.endTime)) AS  hours FROM person p  GROUP BY YEAR(p.beginTime),MONTH(p.beginTime),p.`name` ORDER BY hours DESC; 

你可能感兴趣的:(java开发)