Oracle -- 多个count统计一张表中多个字段等于某值


摘录:https://www.linuxidc.com/Linux/2012-06/62894.htm

case when 条件 then 条件为真时的值 else 条件为假时的值 end

--单独查询统一某个字段等于某值的次数
select count(m.underwriteflag) from prpcmain m where m.underwriteflag='1'  ; --720407
select count(m.nationflag) from prpcmain m where m.nationflag='1'         --720422

--合并查询 select count(case when m.underwriteflag='1' then 1 end)字段1,count(case when m.nationflag='1' then 1 end)字段2 from prpcmain m;

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM