Hey guys, Apologies in advance since I feel like I'm probably forgetting/missing something obvious on this one. Here goes; I'm using a case statement in my WHERE clause, the below works fine:
WHERE r.[SomeCol] = @SomeColVal
AND SomeOtherCol =
(
CASE WHEN (@Year = 0 AND @Period = 0) THEN
@SomeVal
CASE WHEN...
...
CASE ELSE
@SomeVal
END
My "issue" is that I want to add an additional OR clause to my ELSE block..something like this:
WHERE r.[SomeCol] = @SomeColVal
AND SomeOtherCol =
(
CASE WHEN (@Year = 0 AND @Period = 0) THEN
@SomeVal
CASE WHEN...
...
CASE ELSE
@SomeVal OR @SomeVal - 1
END
Naturally, this throws this error: Incorrect syntax near the keyword 'OR'. within the ELSE statement
Hence my question...what is the correct/alternate logic I can use to accomplish this?
Thank you in advance