08 May 2012
Hi, exists() is filter condition. Case will not filter any records. Any filter can be provided in where, join, having, qualify.
10 May 2012
Hi ,
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
FROM TBL2
JOIN TBL1
ON filter condition
You must sign in to leave a comment.
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
FROM TBL2
But i'm getting illegal expression in when clause of case expression.
Pls help