题解 | 统计各岗位员工平均工作时长


WITH temp AS (
    SELECT 
        post,
        round(timestampdiff(second, first_clockin, last_clockin)/3600,3) as work_time
    FROM attendent_tb a
    INNER JOIN staff_tb b
    ON a.staff_id = b.staff_id
)
select
    post
    ,avg(work_time) as work_hours
    from temp
    group by post
    order by work_hours desc

全部评论

相关推荐

不愿透露姓名的神秘牛友
2024-12-31 16:29
24所 无线工程师 总包30w 硕士211
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务