Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
How to Write below SQL Query into QlikView Script in Different ways.
SELECT DLR_CD, BRC_CD,YEAR_MTH,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_01))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_01)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_01)))
END),0) AMT_VAL_01,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_02))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_02)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_02)))
END),0) AMT_VAL_02,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_03))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_03)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_03)))
END),0) AMT_VAL_03
FROM TB_RPT_RCOM202
WHERE KPI_VALUE IN (40,9)
AND YEAR_MTH = '201802'
and brc_cd='BL02A'
GROUP BY YEAR_MTH,DLR_CD, BRC_CD;
Thanks.
Vinod
You should be able to copy/paste that into the QlikView Script Editor and run it after creating a Connect To string to connect to the source DB provided your Connector can handle all of the SQL calls you are making.
That should get you on the right track.
Regards,
Brett
Hi,
you can achieve this by doing following :
TB_RPT_RCOM202:
SQL SELECT DLR_CD, BRC_CD,YEAR_MTH,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_01))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_01)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_01)))
END),0) AMT_VAL_01,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_02))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_02)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_02)))
END),0) AMT_VAL_02,
NVL((CASE WHEN (SUM(DECODE(KPI_VALUE,40,AMT_VAL_03))) = 0 THEN 0
ELSE
(SUM(DECODE(KPI_VALUE,9,AMT_VAL_03)) ) /
(SUM(DECODE(KPI_VALUE,40,AMT_VAL_03)))
END),0) AMT_VAL_03
FROM TB_RPT_RCOM202
WHERE KPI_VALUE IN (40,9)
AND YEAR_MTH = '201802'
and brc_cd='BL02A'
GROUP BY YEAR_MTH,DLR_CD, BRC_CD;
I hope this helps.
Regards,
if my replay helped you then please do not forget to use the "Accept as Solution" button.