#将加班的人标记出来 with t as( select a.staff_id, if(timediff(timediff(last_clockin,first_clockin),'9:30:00')>0,1,0) diff, department from attendent_tb a left join staff_tb s on a.staff_id = s.staff_id ) select department, concat(round((sum(diff) / count(1))*100,1),'%') ratio from t group by department or...