Reputation: 1
I have created three new calculated columns based on existing flag fields A,B, C.
and logic is
1) if flag fields (A or B or C) equals to 'X' Field 1 will be 'X'.
2) if flag fields (A and B) or (B and C) or (A and C) equals to 'X' field 2
3) if flag fields (A and B and C) = 'X' Field 3.
Could you please suggest the code for HANA.
Upvotes: 0
Views: 6477
Reputation: 6612
Please check following CASE statements
select
*,
case when A = 'X' or B = 'X' or C = 'X' then 'X' else NULL end as Field1,
case when (A = 'X' and B = 'X') or (A = 'X' and C = 'X') or (B = 'X' or C = 'X') then 'X' else NULL end as Field2,
case when A = 'X' and B = 'X' and C = 'X' then 'X' else NULL end as Field3
from Flags;
Upvotes: 1