SELECT s.post, ROUND( AVG( TIMESTAMPDIFF (SECOND, a.first_clockin, a.last_clockin) ) / 3600, 3 ) AS work_hours FROM staff_tb as s JOIN attendent_tb as a ON s.staff_id = a.staff_id GROUP BY s.post ORDER BY work_hours DESC
SELECT s.post, ROUND( AVG( TIMESTAMPDIFF (SECOND, a.first_clockin, a.last_clockin) ) / 3600, 3 ) AS work_hours FROM staff_tb as s JOIN attendent_tb as a ON s.staff_id = a.staff_id GROUP BY s.post ORDER BY work_hours DESC