Skip to content
Advertisement

Filter a case in a where clause

I want to filter on a case statement in my where clause for example:

The above does not work.

Advertisement

Answer

I assume you have a from clause

If you can’t change the columns, then you have to repeat the code:

But whenever I see duplicated code like that, I like to move it to a cross apply:

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