日期:2014-05-16 浏览次数:20580 次
select
USERID,successCount,errorCount,NotBackCount,SuccessCM,SuccessCU,SuccessCT,
CONVERT(varchar(50),
cast(cast(17000 as float(20))/POWER(1024,cast(p.Pr as float(20))) as decimal(18,2)))
+ p.suffix SendCMTraffic
from
(select USERID,
SUM(case when REPORT_STAT='DELIVRD' then 1 else 0 end) successCount,
SUM(case when REPORT_STAT<>'DELIVRD' then 1 else 0 end) errorCount,
SUM(case when REPORT_STAT IS NULL then 1 else 0 end) NotBackCount,
SMS_CONTENT,
SUM(case when MOBILE_NO_TYPE=1 AND REPORT_STAT='DELIVRD' THEN 1 ELSE 0 END) SuccessCM,
SUM(case when MOBILE_NO_TYPE=2 AND REPORT_STAT='DELIVRD' THEN 1 ELSE 0 END) SuccessCT,
SUM(case when MOBILE_NO_TYPE=3 AND REPORT_STAT='DELIVRD' THEN 1 ELSE 0 END) SuccessCU
from SMS_MT where
Convert(varchar(8),INTO_TIME,112)=Convert(varchar(8),'20140401',112)
group by USERID,SMS_CONTENT having USERID='xdx') b
,SMS_Suffix p
;