Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

SAP HANA Usage of Grouping

$
0
0

Hi folks,

 

I'm new to SAP HANA and need your help with understanding howGROUPING SETS on HANA works.

 

By executing of this statement

 

SELECT      COUNTRY, LANGU, "SHORT TEXT",
GROUPING(COUNTRY), GROUPING(LANGU), GROUPING("SHORT TEXT"),
GROUPING_ID(COUNTRY, LANGU, "SHORT TEXT")
FROM COUNTRIES
GROUP BY GROUPING SETS ((COUNTRY, LANGU), (LANGU, "SHORT TEXT"))

on this raw table

 

COUNTRYLANGUSHORT TEXT
DEDDeutschland
DEEGermany
USDUSA
USEUSA

 

I'm getting these results:

 

COUNTRYLANGUSHORT TEXTGROUPING(COUNTRY)GROUPING(LANGU)GROUPING(SHORT TEXT)GROUPING_ID
DED?0011
USD?0011
DEE?0011
USE?0011
?DDeutschland1004
?EGermany1004
?DUSA1004
?EUSA1004

 

Two questions raised here:

  • Why is Grouping(...) returning 1 when attribute is NULL and 0 when grouped? Has it not to be reversely?
  • And what about Grouping_ID, I have expected to see 1 and 2, but not 4... What are respective rules here?

 

Regards,

Oleg


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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