Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

UNION ALL is not working in SAP HANA SQL Script?

$
0
0

Hi,

 

I have written an SQL statement as below.

 

 

SELECT GJAHR, SUM(DMBTR) AS "101_DMBTR", SUM(0) as "102_DMBTR" FROM "SAPR3"."MSEG"

where  BWART = '101' and werks = '1102'

group  by GJAHR

union  all

SELECT GJAHR, SUM(0) AS "101_DMBTR", SUM(DMBTR) as "102_DMBTR" FROM "SAPR3"."MSEG"

where  BWART = '102' and werks = '1102'

group  by GJAHR

order  by GJAHR desc;

 

and the out put i'm getting is

UNION ALL for MSEG Error.PNG

 

Here i want to club the values into a single row by year but the output i'm getting is into 2 rows.

 

can anyone suggest me how to solve this issue.

 

Regards,

Ramana.


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>