I am attempting to get an equivalent of DECODE function in MySQL. It operates like this:
Select Name, DECODE(Age,
13,'Thirteen',14,'Fourteen',15,'Fifteen',16,'Sixteen',
17,'Seventeen',18,'Eighteen',19,'Nineteen',
'Adult') AS AgeBracket
FROM Person
The DECODE function will compare the value of the column 'Age' with 13, 14, 15.. and return the appropriate string value 'Thirteen', 'Fourteen'.. and if it matches with nothing, then default value of 'Adult' will be returned.
Any ideas which function in the MySQL can do this same work?
CLARIFICATION: I agree using CASE is one way of achieving the desired result, however I am rather looking for a function because of performance and other reasons.