cancel
Showing results for 
Search instead for 
Did you mean: 

Hana Sql script help needed

Former Member
0 Kudos

Hi guys,

I am new to HANA . I have got a requirement .Please help me with below issue.

I have a table "ABC"

ABC

COUNTRYREGIONREGION ID
USAWEST100
USANORTH700
USANORTH EAST700

Now there is another table DEF

REGION IDCOUNTRYPROFITREVENUE
600USA100200
650USA50150
200UK

50

150
100APAC100250

Now the requirement is

IF "REGION ID" FROM TABLE ABC is 700 then fetch values from table DEF which has REGION ID =600 OR 650 ,and COUNTRY FROM table ABC= COUNTRY from TABLE DEF,and sum (profit+revenue) from table DEF.

Accepted Solutions (0)

Answers (2)

Answers (2)

michael_eaton3
Active Contributor
0 Kudos

Is this an interview question?  I only ask because sum(profit+revenue) satisfies absolutely no functional requirement that I can think of!

Please demonstrate how you would want to see the output.

Michael

Former Member
0 Kudos

yes actually I have hidden the actual measure names

The output should be if we consider the above tables should be

country region idmeasure(prof+revenue)
usa600300
usa650200
michael_eaton3
Active Contributor
0 Kudos

Well, if its an interview question, should you be asking for help?

It can be done using a join, filtering using a where clause and an aggregation.  Thats enough hints!

Michael

gopinath_kolli
Active Participant
0 Kudos

Are there any combinations other than 700-600,650.

Former Member
0 Kudos

Yes it may contain

gopinath_kolli
Active Participant
0 Kudos

Actually it depends on the pattern by which the id joins, if there is no pattern and there are less number of values then we can hard code.