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

#不能直接用daydiff,要用timestampdiff,要用分钟除60计算小时数,要不然会直接截断