MySQL equivalent of DECODE function in Oracle

后端 未结 8 2360
南方客
南方客 2020-11-29 09:26

I am trying to find an equivalent of DECODE function in MySQL. It works like this:

Select Name, DECODE(Age,
       13,\'Thirteen\',14,\'Fourteen\',15,\'Fifte         


        
8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 09:40

    You can use a CASE statement...however why don't you just create a table with an integer for ages between 0 and 150, a varchar for the written out age and then you can just join on that

提交回复
热议问题