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