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

select
    st.post,
    round(
        avg(
            timestampdiff (second, att.first_clockin, att.last_clockin) / 3600
        ),
        3
    ) work_hours
from
    test.staff_tb st
    join test.attendent_tb att on st.staff_id = att.staff_id
where
    att.first_clockin is not null
    and att.last_clockin is not null
group by
    st.post
order by
    work_hours desc

全部评论

相关推荐

06-07 19:59
门头沟学院 C++
补药卡我啊😭:都快15年前的了还在11新特性
你的简历改到第几版了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务