oracle-记录

同時查新多个条件的数量

select sum(DECODE(trim(t.ASSESSED_RESULT),'维持',1,0)) maintainNum,
sum(DECODE(trim(t.ASSESSED_RESULT),'晋升',1,0)) upNum,
sum(DECODE(trim(t.ASSESSED_RESULT),'降级',1,0)) degradeNum,
sum(DECODE(trim(t.ASSESSED_RESULT),'终止合同',1,0)) dissolutionNum
from t_AssessResultInfo t, t02salesinfo_backup s
where s.team_id=#{teamId} and t.sales_code=s.sales_code and s.channel_id=#{channelId} and s.year_month=#{month}
and s.year_month=t.stat_month


猜你喜欢

转载自www.cnblogs.com/jjSmileEveryDay/p/9467345.html