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
you can use if() in place of decode() in mySql as follows This query will print all even id row.
mysql> select id, name from employee where id in
-> (select if(id%2=0,id,null) from employee);
Try this:
Select Name, ELT(Age-12,'Thirteen','Fourteen','Fifteen','Sixteen',
'Seventeen','Eighteen','Nineteen','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult',
'Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult','Adult') AS AgeBracket FROM Person