分段统计数据

select fund_account,BrokerID,
sum(case when RulesID>1000000 AND RulesID<2000000 then 1 else 0 end ),
sum(case when RulesID>2000000 AND RulesID<3000000 then 1 else 0 end ),
sum(case when RulesID>3000000 AND RulesID<4000000 then 1 else 0 end ),
sum(case when RulesID>4000000 AND RulesID<5000000 then 1 else 0 end )
from investorrules where fund_account like '%1%' GROUP BY fund_account,BrokerID limit 1,21

posted @ 2017-11-13 16:23  苍洱  阅读(162)  评论(0编辑  收藏  举报