码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2018-08-31 11:43:35      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:png   family   pre   ora   多个   oracl   条件   color   nat   

摘录: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;

  

技术分享图片

 

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

标签:png   family   pre   ora   多个   oracl   条件   color   nat   

原文地址:https://www.cnblogs.com/wuyuwuyueping/p/9564661.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!