34,575
社区成员
发帖
与我相关
我的任务
分享
select id,statusreport from msghistory
where statusreport in (-1,0,2) and
SendTime>='2007-01-01' and SendTime<='2013/5/5 0:00:00'
select count(id) as allcount,sum(case when statusreport='-1' then 1 else 0 end) as unknow,
sum(case when statusreport='0' then 1 else 0 end) as deliverd,
sum(case when statusreport='2' then 1 else 0 end) as fail
from msgHistory where 1=1 and datediff(dd,'2007-01-01',SendTime)>=0
and datediff(dy,SendTime,'2013-5-5 0:00:00')>=0