The India User Group is live! Be a part of our first Indian user event: JOIN THE EVENT

Alternative to using CASE WHEN logic

GSung
Level 2
Alternative to using CASE WHEN logic

Is there an alternative to using below CASE WHEN SQL formula ? I could not use CASE/WHEN because I have more than 1 statement that is true and it seems to be taking the last true one.

CASE

WHEN

("Column 1" = 'ABC')

AND ("Column 2" ='XYZ')

THEN

'Line item 1'

WHEN

("Column 1" = 'ABC')

AND ("Column 3" = "XYZ")

THEN

'Line item 2'

 

0 Kudos
1 Reply
Clément_Stenac
Dataiker
Dataiker

Hi,

There are no real alternatives to CASE WHEN. It's important to note that your behavior comes from the difference between the two kinds of CASE WHEN statements, that are detailed here: https://dba.stackexchange.com/questions/82487/case-with-multiple-conditions

0 Kudos
A banner prompting to get Dataiku DSS
Public