select department, concat (round(sum(判断) / count(*) * 100, 1), '%') ratio from ( select department, timestampdiff (minute, first_clockin, last_clockin) 分钟数, if ( timestampdiff (minute, first_clockin, last_clockin) > 570, 1, 0 ) 判断 from test.staff_tb st join test.attendent_tb att on st.staff_id = ...