select post,
round(avg(timestampdiff(second,first_clockin,last_clockin))/3600,3) work_hours
from staff_tb join attendent_tb using(staff_id)
where first_clockin is not null and last_clockin is not null
group by post
order by work_hours desc

未打卡:指上班卡和下班卡都没打,这条记录才会被排除,因此需要在WHERE子句中显式去除存在null的情况