



SELECT * FROM SALES3 ORDER BY 1,2;




SELECT * FROM SALES3
    PIVOT
    (
        SUM(SALES_AMT) AS SALES
        FOR F_QTR IN ('1' AS Q1, '2' AS Q2, '3' AS Q3, '4' AS Q4)
    ) TMP
ORDER BY 1;





SELECT * FROM 
    (SELECT F_YR, F_QTR, SALES_AMT FROM SALES3) DT

    PIVOT
    (
        SUM(SALES_AMT) AS SALES
        FOR F_QTR IN ('1' AS Q1, '2' AS Q2, '3' AS Q3, '4' AS Q4)
    ) TMP
ORDER BY 1




