select post ,round(avg(时长)/60,3) work_hours from ( select staff_name ,post ,timestampdiff(minute,first_clockin,last_clockin) 时长 from staff_tb join attendent_tb on staff_tb.staff_id = attendent_tb.staff_id ) a group by post order by work_hours desc

select post ,round(avg(时长)/60,3) work_hours from ( select staff_name ,post ,timestampdiff(minute,first_clockin,last_clockin) 时长 from staff_tb join attendent_tb on staff_tb.staff_id = attendent_tb.staff_id ) a group by post order by work_hours desc