Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Problem with CASE WHEN statement - response (13) by Raja_KT

$
0
0

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

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles