I want to use CASE
in WHERE
clause, but it returns error.
Can I use CASE in where clause? or how to fix it ? Thanks
SELECT * F
In your case, you only need OR
WHERE
(
acting_to is null
OR
(
datediff(day, acting_from, acting_to) >= 90
AND
acting_to >= '2010-10-01'
)
)
A case is for values, not conditions. The condition is outside the CASE expression
eg
CASE
WHEN SomeCol = 'a' THEN ColA
WHEN SomeCol = 'c' THEN ColC
ELSE ColB
END > 42