Standard SQL alternative to Oracle DECODE

后端 未结 4 2048
一个人的身影
一个人的身影 2021-01-02 10:58

Is there an ANSI SQL equivalent to Oracle\'s DECODE function?

Oracle\'s decode function is the IF-THEN-ELSE construct in SQL.

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-02 11:37

    CASE WHEN a=1 THEN value1
         WHEN a=2 THEN value2
         ELSE default
    END
    

    SQL Case Statement Syntax?

提交回复
热议问题