Is it possible to add IN inside a case statement of WHERE clause as below:
WHERE
CASE WHEN @id IN(1,2) THEN ...
CASE WHEN @id IN(3,4) THEN...
I got syntax error…I then tried by removing IN adding OR as below:
CASE WHEN @id = 1 OR @id = 2 THEN ...
CASE WHEN @id = 3 OR @id = 4 THEN ...
It worked….but just for curiosity I want to know whether somehow we can use IN…
please help
You need to explain further. This is definitely valid syntax:
What is in your
THENstatement?