Skip to content
Advertisement

using case statement in a where clause

Hello I am missing something because my code errors.

I’ve attempted several combinations and each one errors at either the first equal sign or the second. What am I missing?

Advertisement

Answer

The branches of a case expression can only return values, not additional expressions to be evaluated in the where condition. You could, however, simulate this behavior with the and and or logical operators:

Note that you have makeup = 0 on both branches of the case expression in the question (or both sides of the or in the answer), so you could extract it out of it and simplify the condition a bit:

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