select no,sum(case when worktype='a' then 1 else 0 end) as 'a',
sum(case when worktype='b' then 1 else 0 end) as 'b'
sum(case when worktype='c' then 1 else 0 end) as 'c'
from table group by no应该去SQLServer版问,那里高手云集!
sum(case when worktype='b' then 1 else 0 end) as 'b'
sum(case when worktype='c' then 1 else 0 end) as 'c'
from table group by no应该去SQLServer版问,那里高手云集!
你经常跑这里来?