on 01-13-2015 11:58 AM
I'm translating some legacy SQL into HANA model.... and I'm going around in circles with this one.
Here's some 'traditional' SQL to illustrate what I am trying to do:
SELECT
ADRC_D.CLIENT
, ADRC_D.ADDRNUMBER
, COALESCE (ADRC_I.NAME1, ADRC_D.NAME1) AS Name1
FROM
ADRC_D
LEFT OUTER JOIN
ADRC_I
ON
ADRC_D.CLIENT = ADRC_I.CLIENT AND
ADRC_D.ADDRNUMBER = ADRC_I.ADDRNUMBER
In a calculation view, I tried IFFNULL, but that won't let me include columns in my expression, unless I've used them as 'select' columns ... and I do not want them as select columns.
This must be a really common requirement, so I am sure there is a standard method of achieving ?
Many Thanks
Ok, so 90 views and no reply ... suggests I'm asking something dumb ?
Anyone care to comment on the appropriateness of the question ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bush,
Yes if you want to use the IFNULL functionality in a graphical calculation view, you need to select the used columns first(By the way, not selecting columns doesn't make any sense. In your SQL also, you are selecting ADRC_I.NAME1 and ADRC_D.NAME1. In calculation view, you are selecting it directly instead ). Otherwise , you can go for a scripted calculation view with case statement in the selection to achieve the same.
Sreehari
"By the way, not selecting columns doesn't make any sense"
Not sure what makes you say that ?
If I select name1 from T1 and again form T2, and in addition, create my composite column; then any user of my model will be staring at 3 similar columns, 2 of which are 'incorrect' data.
Unnecessary confusion.
If however, I create my composite column and do not expose the originals, the users will see only 1 unambiguous column.
"In your SQL also, you are selecting ADRC_I.NAME1 and ADRC_D.NAME1"
I guess that depends on your definition of 'selecting' !!
I am not exposing the columns as output.
I will try to explain my understandings .
SELECT
ADRC_D.CLIENT
, ADRC_D.ADDRNUMBER
, COALESCE (ADRC_I.NAME1, ADRC_D.NAME1) AS Name1
FROM
ADRC_D
LEFT OUTER JOIN
ADRC_I
ON
ADRC_D.CLIENT = ADRC_I.CLIENT AND
ADRC_D.ADDRNUMBER = ADRC_I.ADDRNUMBER
You are not selecting ADRC_I.NAME1, ADRC_D.NAME1 columns, but you are projecting it. For COALESCE (or any such calculated columns) calculation would happen for each and every record which is returned. That is why I said, we are selecting it . In a calculation view also, the selection will happen only in the semantic node.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.