Can we use such query in teradata
Hi i'm trying to execute the below query in teradata sql assistant.
SELECT TBL2.Column, (CASE WHEN EXISTS(SELECT Col1 FROM TBL1)
THEN '1' ELSE '0' END) AS TEMPCOL
But i'm getting illegal expression in when clause of case expression.
Can you be specific about your requirement?
Don think we can use subqueries inside CASE statement. Instead you can join TBL1 and TBL2 and use IN in CASE statement like
SELECT TBL2.Column , CASE WHEN TBL2.column IN (TBL1.Col1) THEN '1' ELSE '0' END AS TEMPCOL
ON filter condition