Hi,I am trying to put the Case statement in Where clause but DB gives me error:-3706. Syntax Error : expected something between ')' and the 'between' keyword.Is Teradata supports the Where clause with Case statement.Query like:-Select Start_time_id,datetimefromDatetime_TableWhere Case When 'Previous Day' then ((Start_time_id) between 12345 And 123459)When 'Previous Week' then ((Start_time_id) between 23456 And 234459)ENDPlease suggest me..Or explain me with some example.Regards,Akash
Hi,Against which column you want to quantify or what is the exact requirement?
In a CASE expresssion, THEN must be followed by a scalar value expression. The entire CASE expression evaluates to a scalar value, not a predicate. You can use CASE in a WHERE clause, but the outer expression must be used in a predicate, as in the following example:SELECT * FROM tWHERE x = CASE WHEN y=2 THEN 1 ELSE 2 END;