求助一条SQL语句
一个表temp中有id(自动增长),employee,type,date
type有三种情况(迟到,早退,缺勤)
求怎么用一条语句写出同时查询迟到,早退,缺勤的次数
------解决方案--------------------错了select sum(case type when 迟到 then 1 else 0 end) as 迟到数,
sum(case type when 早退 then 1 else 0 end) as 早退数,
sum(case type when 缺勤 then 1 else 0 end) as 缺勤数
from temp