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

sql語(yǔ)句:
最后結(jié)果:

create table t(class char(1),callcount int,calldate date)

sql語(yǔ)句:
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類
最后結(jié)果:
