오라클 컬럼을 로우로

SELECT DECODE (MOD (ROWNUM - 1, 3) + 1, 
                 1, SUM_TARGET_SALES_AMT, 
                 2, MALL_TARGET_SALE_AMT, 
                 3, MALL_OUT_CHANNEL_TARGET_SALE_AMT) AS TARGET_SALE_AMT
  FROM (SELECT 1
              FROM DUAL
        CONNECT BY LEVEL <= 3), (
          SELECT                        
            TARGET_VAL            AS SUM_TARGET_SALES_AMT,
            TARGET_CLIENT_TBH     AS MALL_TARGET_SALE_AMT,
            TARGET_CLIENT_TBH_OUT - 100 AS MALL_OUT_CHANNEL_TARGET_SALE_AMT    
          FROM TARGET_DATAS
          WHERE TARGET_YEAR = '2017'
          AND TARGET_MONTH = '09'
          AND TARGET_DIVI_CD = '10'  
        ) TT


+ Recent posts