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

Re: Self join in SAP HANA

$
0
0

Hi Riccardo.

 

Could you write example of CE_PROJECTION function with OR-using in WHERE?

VAR_OUT = CE_PROJECTION(:JOIN_TAB,                             ["DOC_NUMBER","S_ORD_ITEM","KONDM","UEPOS","UEPOS_KONDM","SUBTOTAL_2"],

                            'UEPOS_KONDM !=''15'' OR UEPOS_KONDM IS NULL');

and

VAR_OUT = CE_PROJECTION(:JOIN_TAB,                             ["DOC_NUMBER","S_ORD_ITEM","KONDM","UEPOS","UEPOS_KONDM","SUBTOTAL_2"],

                            'UEPOS_KONDM !=''15'' OR UEPOS_KONDM = ''?''');

returns errors.

 

You're right in "a NULL value will be present in any column coming from the "right" table.".

And, as I understand, HANA presents NULL value as "?" - see rows 10, 110, 130 in my example, where uepos_kondm = ?.

left_join.PNG

 

Also I wrote that projection

VAR_OUT = CE_PROJECTION(:JOIN_TAB,                         ["DOC_NUMBER","S_ORD_ITEM","KONDM","UEPOS","UEPOS_KONDM","SUBTOTAL_2"],

                            '"UEPOS_KONDM" != ''?''');

works correct and returns 4 rows from 7 source rows.

 

But projection

VAR_OUT = CE_PROJECTION(:JOIN_TAB,                      ["DOC_NUMBER","S_ORD_ITEM","KONDM","UEPOS","UEPOS_KONDM","SUBTOTAL_2"],

                            '"UEPOS_KONDM" != ''15''');

returns only 2 rows from 7 instead of 5.

I wonder why it works in another way.

 

Such self-join on abap took me 10 seconds but it has already took 4 days on SQLscript!


Viewing all articles
Browse latest Browse all 9165

Trending Articles



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