Hi,
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
is your "if else" itself. I think you need to understand what is required and change your logic.
TYPE_cD IN ('03') AND STS_CD='N' means if ist condition is true and also STS_CD='N' is true then 0. It is ANDING operation(boolean logic).
You have two values to be assigned, either 0 or 1. Put those logics properly like WHEN TYPE_CD IN ('01','02','03') AND STS_CD<>'N' THEN 1 say for example if it suits the reqt.
Cheers,
Raja
Hi,
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
is your "if else" itself. I think you need to understand what is required and change your logic.
TYPE_cD IN ('03') AND STS_CD='N' means if ist condition is true and also STS_CD='N' is true then 0. It is ANDING operation(boolean logic).
You have two values to be assigned, either 0 or 1. Put those logics properly like WHEN TYPE_CD IN ('01','02','03') AND STS_CD<>'N' THEN 1 say for example if it suits the reqt.
Cheers,
Raja