如果迟到早退1次以上,还可以这样计算么??
declare @a varchar(1000)
set @a='select name'
select @a=@a+',sum(case ARRIVE when '''+ARRIVE+''' then 1 else 0 end) ['+ARRIVE+']'
from (select distinct ARRIVE from a) as b
select @a=@a+' from a group by name'
exec (@a)