반응형

WITH A AS (

SELECT 'A' AS AA FROM DUAL UNION ALL

SELECT 'B' AS AA FROM DUAL UNION ALL

SELECT 'C' AS AA FROM DUAL UNION ALL

SELECT 'D' AS AA FROM DUAL UNION ALL

SELECT 'E' AS AA FROM DUAL UNION ALL

SELECT 'F' AS AA FROM DUAL

)

SELECT MAX(A),MAX(B),MAX(C),MAX(D),MAX(E),MAX(F)

FROM (

SELECT DECODE(AA,'A',AA,NULL) AS A,

       DECODE(AA,'B',AA,NULL) AS B,

       DECODE(AA,'C',AA,NULL) AS C,

       DECODE(AA,'D',AA,NULL) AS D,

       DECODE(AA,'E',AA,NULL) AS E,

       DECODE(AA,'F',AA,NULL) AS F       

FROM A

);

반응형

WRITTEN BY
데르벨준

,