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

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

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

# 各岗位 平均工作时长
with
t1 as(
    select
        staff_id,
        post,
        timestampdiff(second,first_clockin,last_clockin) / 3600 as worktime
    from
        attendent_tb left join staff_tb using(staff_id)
    where
        first_clockin is not null
)
,t2 as(
    select distinct
        post,
        avg(worktime)over(partition by post) as work_hours
    from
        t1
)

select * from t2 order by work_hours desc

全部评论

相关推荐

LZHR:老哥你从投递简历测评完到一面中间隔了多久呀,我这边已经过了五天了仍显示简历筛选中是不是就是挂了
腾讯求职进展汇总
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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