题解 | 统计加班员工占比

SELECT department,CONCAT(ROUND(SUM(IF(TIMESTAMPDIFF(MINUTE,first_clockin,last_clockin)/60 > 9.5, 1, 0))/COUNT(staff_name)*100,1),'%') AS ratio
FROM staff_tb
LEFT JOIN attendent_tb
USING(staff_id)
GROUP BY department
ORDER BY ratio DESC

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务