In this sql CASE statement:
CASE WHEN col1 = 'X' then 'A'
CASE when col2 = 'Y' then 'B'
else 'C' as result ...
if col1=X, and col2 = Y, will the output be 'A' or 'B' ? i.e. is the CASE statement functioning as an if or an else-if?
In this sql CASE statement:
CASE WHEN col1 = 'X' then 'A'
CASE when col2 = 'Y' then 'B'
else 'C' as result ...
if col1=X, and col2 = Y, will the output be 'A' or 'B' ? i.e. is the CASE statement functioning as an if or an else-if?
The evaluation of cases will terminate on the first one that evaluates to TRUE.