select post, round(avg(timestampdiff(second, first_clockin, last_clockin)/60/60), 3) as work_hours from staff_tb staff join attendent_tb att on staff.staff_id=att.staff_id where first_clockin is not null and last_clockin is not null group by post order by work_hours desc

京公网安备 11010502036488号