case case子句中的复合条件

时间:2012-01-12 08:16:47

标签: sql oracle conditional-statements

对于给定的例子,我写的是

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'

复合条件如when 1 [和] 其他'然后'值。

应该使用什么操作符代替[和]?

谢谢!

1 个答案:

答案 0 :(得分:5)

建议你以不同的方式构建你的案例:

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
相关问题