题解 | #统计各岗位员工平均工作时长#
统计各岗位员工平均工作时长
https://www.nowcoder.com/practice/b7220791a95a4cd092801069aefa1cae
select t1.post, round(avg(t1.hour_diff)/60,3) as work_hours from ( select *, timestampdiff(minute,first_clockin,last_clockin) as hour_diff from attendent_tb at left join staff_tb st using(staff_id) )as t1 group by t1.post order by work_hours desc;