xywuyiba7 发表于 2016-11-7 00:25:10

一条实现每一天统计数据的sql语句(sql server)

  select telco,count(telco) as count,datediff(day,'2012-05-15',left(adate,8)) as arrayNo
from platform.dbo.akn_outgoing_log 
where resp_status=2 and adate>'20120515' and adate<'20120521'
          and telco in(0011,0003,0001)
          group by telco,datediff(day,'2012-05-15',left(adate,8)) order by telco,arrayNo
  
  
  adate在数据库类型是字符串例如20120521110016
页: [1]
查看完整版本: 一条实现每一天统计数据的sql语句(sql server)