oracle case when 在查询时候的用法。

Posted hello world!!!!!

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle case when 在查询时候的用法。相关的知识,希望对你有一定的参考价值。

select count(1), features_level
  from (SELECT i.features_level,
               i.features,
               T.BASEAMINE_ID,
               T.COLUMN_NAME,
               V.COLUMN_VALUE,
               V.DETAIL_ID,
               
               (case
                 when i.features = ‘计数‘ AND V.COLUMN_VALUE = ‘NG‘ then
                  0
                 when (i.features = ‘计量‘ AND V.COLUMN_VALUE <> ‘-‘) and
                      (to_number(V.COLUMN_VALUE) > i.offset_value_up or
                      to_number(V.COLUMN_VALUE) <= i.offset_value_low) then
                  0
                 else
                  1
               end) as illLegal
        
          FROM OQC_BASE_STANDRAD_TITLE T
         INNER JOIN OQC_BASE_STANDRAD_VALUE V
            ON T.ID = V.COLUMN_ID, oqc_inspection_sample_item i
         WHERE T.STATE = ‘A‘
           AND T.BASEAMINE_ID = ‘EDF58BDBA5D14800B2C19B539EE795EF‘
           and t.is_insepection_result = ‘1‘
           and v.detail_id = i.id)
 where illLegal = 0
 group by features_level
 
 --select * from oqc_inspection_sample s 
  

  

以上是关于oracle case when 在查询时候的用法。的主要内容,如果未能解决你的问题,请参考以下文章

ORACLE CASE WHEN 及 SELECT CASE WHEN的用法

Oracle CASE WHEN 用法介绍

Oracle CASE WHEN函数用法

Oracle CASE WHEN函数用法

select case when,用来判断查询

oracle中case when的用法