数据表
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
最后结果: