Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3363

HOW TO USE UNION WITH CONSTANT VALUES IN SCRIPTED VIEW

$
0
0

Hi All,

 

I am doing a work out on Union operator. When using Union in calculation view by default it will work as union with constant values. but same is not possible in Scripted view.

 

For Eg: Table1

 

SALES1.PNG

 

Table2

SALES2.PNG

 

Below is the output of calculation view which i used union node:

calc view with union node.PNG

 

Output:

 

 

Calc view union output.PNG

 

Same output i get using below query in scripted view

 

SELECT REGION_ID,PRODUCT_ID,SUM(SALES_AMOUNT),SUM(DISCOUNT) FROM(

SELECT REGION_ID,PRODUCT_ID,SALES_AMOUNT,0 AS DISCOUNT FROM "NEO_B45RWNY007IMPIDRM4ZSG1OV0"."SALES"

UNION ALL

SELECT * from "NEO_B45RWNY007IMPIDRM4ZSG1OV0"."SALES1") GROUP BY REGION_ID,PRODUCT_ID;

 

Is there any other syntax like union with constant values in sql hana

 

Thanks,

Rithika


Viewing all articles
Browse latest Browse all 3363

Trending Articles