求總數case when


select agent_id, count(1) as zbs,sum(je) as zje from (

select agent_id,
sum(case when sjje < 2000 and fxzt = 0 then sjje
when sjje < 2000 and fxzt = 1005 then -1*sjje end) je
from t_payfee_power where result_code = 0 and fxzt in (0,1005)

) a group by a.agent_id
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章