按月分类统计

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;



 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值