题解 | 统计加班员工占比

select
    department,
    concat (
        round(
            count(
                if (
                    timestampdiff (minute, first_clockin, last_clockin) > (9.5 * 60),
                    1,
                    null
                )
            ) / count(st.staff_id) * 100,
            1
        ),
        '%'
    ) as ratio
from
    staff_tb st,
    attendent_tb at
where
    st.staff_id = at.staff_id
group by
    department
order by
    ratio desc

全部评论

相关推荐

03-28 19:11
铜陵学院 C++
有礼貌的山羊追赶太阳:太典了,连笔试都没有开始就因为HC满了而结束了,而且还卡你不让你再投其他部门的。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务