日期:2014-05-17 浏览次数:20592 次
select appID,serviceCode,wayID, sum(case when receipt=0 then 1 else 0 end) as rec0, sum(case when receipt>0 then 1 else 0 end) as rec1, sum(case when result=0 then 1 else 0 end) as res0, sum(case when result>0 then 1 else 0 end) as res1 from CupSmsMT where receipt >= 0 or result >= 0 group by appID,serviceCode,wayID
------解决方案--------------------
select appID,serviceCode,wayID, count(case when receipt=0 then 1 else null end), count(case when receipt>=0 then 1 else null end), count(case when result>=0 then 1 else null end), count(case when result=0 then 1 else null end) from CupSmsMT group by appID,serviceCode,wayID