Regarding Query Info

Database
N/A

Regarding Query Info

Hi All,

Can I use this below condition in the case statement which have two columns from the same table like
:
Case
When ANS.Column_mig <> ANS.Column_mig2

OR

Case
When ANS.Column_mig = ANS.Column_mig2

also would like to know the syntax for nested case statements ?

Thanks for your replies..
2 REPLIES

Re: Regarding Query Info

syntax look correct.

Nested case syntax is below (same as typical if ...else)

case when condition1 then
case when condition 2 then result2
else result3
end
else result4
end
N/A

Re: Regarding Query Info

Hi Friends,

Could you also confirm,can we use IN and NOT IN functions in Case statements also like below :
When (COLUMN_1 = 'X' And COLUMN_2 in('20','21' ))

Thanks for your responses