一条实现每一天统计数据的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

你可能感兴趣的:(SQL Server)