select s.department department,concat(round(sum(if(w.wh>9.5,1,0))/COUNT(DISTINCT s.staff_id) * 100,1),'%') ratio from( select staff_id,timestampdiff(second,first_clockin,last_clockin)/3600 wh from attendent_tb ) w right join staff_tb s on w.staff_id=s.staff_id group by department order b...