或select id,
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 table1 group by id order by idSQL日期
select * from table1 where selldate> :D1 and selldate < :d2
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:00:00');
query1.Params[0].AsDateTime:=StrtoDateTime('2002-05-28 19:10:00');