CASE .. WHEN expression in Oracle SQL

前端 未结 9 868
北荒
北荒 2020-12-04 13:17

I have the table with 1 column and has following data

Status
a1
i
t
a2
a3

I want to display the following result in my select query

9条回答
  •  北海茫月
    2020-12-04 13:51

    You can rewrite it to use the ELSE condition of a CASE:

    SELECT status,
           CASE status
             WHEN 'i' THEN 'Inactive'
             WHEN 't' THEN 'Terminated'
             ELSE 'Active'
           END AS StatusText
    FROM   stage.tst 
    

提交回复
热议问题