C/C++教程

oracel根据条件不同,统计数据sql

本文主要是介绍oracel根据条件不同,统计数据sql,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
select count(case
               when ml_type = '00' then
                'gjml'
             end) gjml,
       count(case
               when ml_type = '32' then
                'jsml'
             end) jsml,
       count(case
               when use_level = '0' then
                'gjxs'
             end) gjxs,
       count(case
               when use_level = '01' then
                'sjxs'
             end) sjxs,
       count(case
               when use_level = '02' then
                'shijxs'
             end) shijxs,
       count(case
               when use_level = '03' then
                'xjxs'
             end) xjxs,
       count(case
               when use_level = '01,02,03' then
                'gtxs'
             end) gtxs
  from qzqd.T_CATALOG_MESSAGE t
 where 1 = 1
   and t.DATA_VALID_FLAG = '1'
   and STATE = '2'
   and YWTYPE != '3'

  

这篇关于oracel根据条件不同,统计数据sql的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!