Unpivot Operator in Oracle
Search Results
Unpivot Operator in Oracle--==============================
--====================================================
select * from
XX_SUP_TAX_DET_TL
SUPPLIER_CODE
|
TYPE
|
SGST_AMOUNT
|
CGST_AMOUNT
|
IGST_AMOUNT
|
1b7718
|
GST_CM
|
-113257.06
|
||
1b7718
|
GST_INV
|
488309.37
|
||
24ec85
|
GST_CM
|
-2582.78
|
-2582.78
|
|
24ec85
|
GST_INV
|
7029.14
|
7029.14
|
|
33767e
|
GST_CM
|
-3199.34
|
-3199.34
|
|
33767e
|
GST_INV
|
20414.48
|
20414.48
|
|
35a382
|
GST_INV
|
180.38
|
180.38
|
--==================
UNPIVOT =============================
select * from XX_SUP_TAX_DET_TL
UNPIVOT (
TAX_AMOUNT FOR
LINE_TYPE IN (
SGST_AMOUNT AS 'SGST'
,
CGST_AMOUNT AS 'CGST'
,
IGST_AMOUNT AS 'IGST'
) )
ORDER BY 1
SUPPLIER_CODE
|
TYPE
|
LINE_TYPE
|
TAX_AMOUNT
|
1b7718
|
GST_CM
|
IGST
|
-113257.06
|
1b7718
|
GST_INV
|
IGST
|
488309.37
|
24ec85
|
GST_INV
|
SGST
|
7029.14
|
24ec85
|
GST_CM
|
CGST
|
-2582.78
|
24ec85
|
GST_CM
|
SGST
|
-2582.78
|
24ec85
|
GST_INV
|
CGST
|
7029.14
|
33767e
|
GST_CM
|
SGST
|
-3199.34
|
33767e
|
GST_CM
|
CGST
|
-3199.34
|
33767e
|
GST_INV
|
SGST
|
20414.48
|
33767e
|
GST_INV
|
CGST
|
20414.48
|
35a382
|
GST_INV
|
SGST
|
180.38
|
35a382
|
GST_INV
|
CGST
|
180.38
|
select * from XX_SUP_TAX_DET_TL
UNPIVOT INCLUDE NULLS( TAX_AMOUNT FOR LINE_TYPE IN (
SGST_AMOUNT AS 'SGST'
, CGST_AMOUNT AS 'CGST'
, IGST_AMOUNT AS 'IGST'
) )
Comments
Post a Comment