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

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

https://www.nowcoder.com/practice/b7220791a95a4cd092801069aefa1cae

with group1 as (
    select
    post,
    round(avg(timestampdiff(second,first_clockin,last_clockin) / 3600),3) as work_hours
    #应用hour的话不准确
    from staff_tb s1
    left join attendent_tb a1 on s1.staff_id = a1.staff_id
    where first_clockin is not null and last_clockin is not null
    group by post
)

select
    post,
    work_hours
from group1
order by work_hours desc

全部评论

相关推荐

02-12 01:30
已编辑
四川文理学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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