數(shù)據(jù)表
t的ddl:
create table t(class char(1),callcount int,calldate date)

sql語句:
select calldate,
sum(case class when '1' then callcount else 0 end)
as A類,
sum(case class when '2' then callcount else 0 end)
as B類,
sum(case class when '3' then callcount else 0 end)
as C類
from t group by calldate
最后結(jié)果:
