lexeme
lexeme

Reputation: 2973

Compound condition inside case clause

Howcome I write, for a given example,

select attendee, begindate
case evaluation
    when 1 then 'bad'
    when 2 then 'mediocre'
    when 3 then 'ok'
    when 4 then 'good'
    when 5 then 'excellent'
    else 'not filled in'
end
from registrations
where course = 'S02'

compound condition like when 1 [and] something else 'then' value.

What operator should use instead of [and]?

Thanks!

Upvotes: 1

Views: 861

Answers (1)

Mutation Person
Mutation Person

Reputation: 30498

Suggest you construct your case slighly differently:

case
    when evaluation in (1,2) then 'bad'
    when evaluation = 3 then 'ok'
    when evaluation = 4 then 'good'
    when evaluation = 5 then 'excellent'
    else 'not filled in'
end

Upvotes: 5

Related Questions