select post, round(avg(wh),3) work_hours
from
(
select post,
       timestampdiff(minute,first_clockin,last_clockin)/60 as wh
from staff_tb a
left join attendent_tb b
using(staff_id)) t1
group by post
order by work_hours desc

- 由于需要精度较高的数字,时间差这里应该取分钟再除60而不是直接取小时