728x90
반응형

SELECT
                AC AS TABLE_NAME,
                SUM(DECODE(MM,'01',CNT)) AS M1,
                SUM(DECODE(MM,'02',CNT)) AS M2,
                SUM(DECODE(MM,'03',CNT)) AS M3,
                SUM(DECODE(MM,'04',CNT)) AS M4,
                SUM(DECODE(MM,'05',CNT)) AS M5,
                SUM(DECODE(MM,'06',CNT)) AS M6,
                SUM(DECODE(MM,'07',CNT)) AS M7,
                SUM(DECODE(MM,'08',CNT)) AS M8,
                SUM(DECODE(MM,'09',CNT)) AS M9,
                SUM(DECODE(MM,'10',CNT)) AS M10,
                SUM(DECODE(MM,'11',CNT)) AS M11,
                SUM(DECODE(MM,'12',CNT)) AS M12
FROM               
    (SELECT TABLE_NAME AC, SUBSTR(A.TDM_RELEASE_DATE,6,2) MM, COUNT(B.EVENT_TYPE) CNT
         FROM
              ( SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_MP_ENGINEERING_CHANGE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_MP_FIRST_RELEASE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_PROTO_RELEASE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_ROUTING_CHANGE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_ROUTING_EC
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_ROUTING_PILOT_RELEASE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_PACKING_CHANGE
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_PACKING_EC
                UNION
                SELECT OBJECT_ID, TO_CHAR(TDM_RELEASE_DATE,'yyyy-MM-dd') TDM_RELEASE_DATE FROM TN_PACKING_PILOT_RELEASE           
              ) A,
              (SELECT EVENT_TYPE,EO_CLASS_ID,EO_OBJECT_ID,TABLE_NAME
                    FROM EO_EVENT T1,TDM_CLASS T2
                    WHERE T1.EO_CLASS_ID=T2.CLASS_ID
              ) B
             
         WHERE B.EO_OBJECT_ID = A.OBJECT_ID
         AND A.TDM_RELEASE_DATE like '2008%'
         GROUP BY TABLE_NAME, SUBSTR(A.TDM_RELEASE_DATE,6,2)
     )
     GROUP BY AC 

728x90
반응형
블로그 이미지

nineDeveloper

안녕하세요 현직 개발자 입니다 ~ 빠르게 변화하는 세상에 뒤쳐지지 않도록 우리모두 열심히 공부합시다 ~! 개발공부는 넘나 재미있는 것~!

,