Oracle case when 用法

来源:互联网 发布:网络封包有哪些 编辑:程序博客网 时间:2024/06/05 16:43
SELECT B_BRIDGE."ID",B_BRIDGE.BRIDGENAME,V_BRIDGESTATE.STATE,(case when (V_BRIDGESTATE.SCORE >= 90 and V_BRIDGESTATE.SCORE <= 100) then 'A'            when (V_BRIDGESTATE.SCORE >= 80 and V_BRIDGESTATE.SCORE <= 89) then 'B'            when (V_BRIDGESTATE.SCORE >= 66 and V_BRIDGESTATE.SCORE <= 79) then 'C'            when (V_BRIDGESTATE.SCORE >= 50 and V_BRIDGESTATE.SCORE <= 65) then 'D'            when (V_BRIDGESTATE.SCORE < 50) then 'E'       end) as SCORE ,(case when (V_BRIDGESTATE.STATE = 'red') then '红色报警'            when (V_BRIDGESTATE.STATE = 'green') then '正常'            when (V_BRIDGESTATE.STATE = 'yellow') then '黄色报警'       end) as red FROM V_BRIDGESTATE
原创粉丝点击