Skip to content
Advertisement

SQL use CASE statement in WHERE IN clause

Is it posible to use case in where in clause? Something like this:

This code gives the error : Incorrect syntax near ‘,’.

Advertisement

Answer

No you can’t use case and in like this. But you can do

BTW you can reduce that to

since or P.Status IN (1,3) gives you also all records of @Status='published' and P.Status IN (1,3)

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement