Hi,
I am facing an issue with the CASE statements. Please find below the case statement,
CASE
WHEN TYPE_CD IN ('01','02','03') THEN 1
WHEN TYPE_cD IN ('03') AND STS_CD='N' THEN 0
ELSE 0
END as CNT
here, CNT is always assigned as '1', even if the TYPE_CD=03 and STS_CD='N'.. If the first CASE statement is executed, will the second statement not execute?
I tried changing the sequence of the case statements like,
CASE
WHEN TYPE_cD IN ('03') AND STS_CD='N' THEN 0
WHEN TYPE_CD IN ('01','02','03') THEN 1
ELSE 0
END as CNT
Then, the record with TYPE_CD=03 and STS_CD='N' is assigned 0 as CNT.
Can someone help me understand this?
Regards,
Anu
Hi,
I am facing an issue with the CASE statements. Please find below the case statement,
CASE
WHEN TYPE_CD IN ('01','02','03') THEN 1
WHEN TYPE_cD IN ('03') AND STS_CD='N' THEN 0
ELSE 0
END as CNT
here, CNT is always assigned as '1', even if the TYPE_CD=03 and STS_CD='N'.. If the first CASE statement is executed, will the second statement not execute?
I tried changing the sequence of the case statements like,
CASE
WHEN TYPE_cD IN ('03') AND STS_CD='N' THEN 0
WHEN TYPE_CD IN ('01','02','03') THEN 1
ELSE 0
END as CNT
Then, the record with TYPE_CD=03 and STS_CD='N' is assigned 0 as CNT.
Can someone help me understand this?
Regards,
Anu