select
case when AudioType=1 then '硬广'
when audiotype=21 then '台标'
when audiotype=22 then '片花'
when audiotype=23 then '报时'
end as AudioType,
isnull(isnull(count(case when month(createtime)=1 then AudioType end),0),0) as '1月份总额 ',
isnull(count(case when month(createtime)=2 then AudioType end),0) as '2月份总额 ',
isnull(count(case when month(createtime)=3 then AudioType end),0) as '3月份总额 ',
isnull(count(case when month(createtime)=4 then AudioType end),0) as '4月份总额 ',
isnull(count(case when month(createtime)=5 then AudioType end),0) as '5月份总额 ',
isnull(count(case when month(createtime)=6 then AudioType end),0) as '6月份总额 ',
--isnull(count(case when month(createtime)=7 then AudioType end),0) as '7月份总额 ',
--isnull(count(case when month(createtime)=8 then AudioType end),0) as '8月份总额 ',
--isnull(count(case when month(createtime)=9 then AudioType end),0) as '9月份总额 ',
--isnull(count(case when month(createtime)=10 then AudioType end),0) as '10月份总额 ',
--isnull(count(case when month(createtime)=11 then AudioType end),0) as '11月份总额 ',
--isnull(count(case when month(createtime)=12 then AudioType end),0) as '12月份总额 ' ,
isnull(count(AudioType),0) as '合计总额 '
from AudioTask
where CreateTime between '2014-1-1' and '2014-6-25' group by AudioType having audiotype in(1,21,22,23)
order by AudioType;