select a.cpname , sum(b.allin),sum(b.allout) ,sum(b.allnow)
,sum(case b.outnum when '01' then b.allout else 0 end)
,sum(case b.outnum when '02' then b.allout else 0 end)
from a left outer join b
on b.cpname = a.cpname
group by a.cpname
--未测试。
,sum(case b.outnum when '01' then b.allout else 0 end)
,sum(case b.outnum when '02' then b.allout else 0 end)
from a left outer join b
on b.cpname = a.cpname
group by a.cpname
--未测试。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货