【问题标题】:Compound condition inside case clausecase 子句中的复合条件
【发布时间】:2012-02-08 13:16:36
【问题描述】:

对于一个给定的例子,我怎么写,

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 [and] something else 'then' 值。

应该使用什么运算符来代替 [and]?

谢谢!

【问题讨论】:

    标签: sql oracle conditional-statements


    【解决方案1】:

    建议您稍微不同地构建您的案例:

    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
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-02
    • 2011-08-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多