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

HANA SQL result not as expected

$
0
0

I'm very new to SQL and HANA, I met a problem which cost me a lot time. I need help here.

 

I want to get some data from a Calculation View, I wanna get the aggregation of HSL.so I write:

 

------------------------------------------------------------------------------------------------------------------------

Script 1:


SELECT

    HSL

FROM "_SYS_BIC"."tmp.fi.rtc.cube/ZRTC_C_ACDOCA0DL"

where rclnt = '500' and rldnr = '0L' and rcomp = 'ZFA2' and bilkt = '0003020000'

------------------------------------------------------------------------------------------------------------------------

But I got the wrong answer.


When I use the following and do the aggregation my self in Excel, I get the right result

------------------------------------------------------------------------------------------------------------------------

Script 2:

SELECT

     *

--    HSL

 

 

FROM "_SYS_BIC"."tmp.fi.rtc.cube/ZRTC_C_ACDOCA0DL"

where rclnt = '500' and rldnr = '0L' and rcomp = 'ZFA2' and bilkt = '0003020000'


------------------------------------------------------------------------------------------------------------------------

 

And I tried the third script, also do the aggregation in Excel, get the right result.

------------------------------------------------------------------------------------------------------------------------

Script 3:

SELECT

--     *

    HSL

 

 

FROM "_SYS_BIC"."tmp.fi.rtc.cube/ZRTC_C_ACDOCA0DL"

where rclnt = '500' and rldnr = '0L' and rcomp = 'ZFA2' and bilkt = '0003020000'

and belnr <> ''

------------------------------------------------------------------------------------------------------------------------

of course BELNR is always not nil and not empty.


I don't know why, these three scripts should give me the same result, isn't it?


Finally, I tried to change my Calculation View, I used to use aggregation in the lowest level, and after changing the aggregation into projection, I get the expected result in the first script.


But why? How could the aggregation in the lowest affects the result?


Viewing all articles
Browse latest Browse all 6412

Trending Articles