You need to use CASE like so...
mysql> create table test (code varchar(1)) //
Query OK, 0 rows affected (0.27 sec)
mysql> insert into test values ('a'),('b'),('c') //
Query OK, 3 rows affected (0.05 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select code from test //
+------+
| code |
+------+
| a |
| b |
| c |
+------+
3 rows in set (0.00 sec)
mysql> select case code when 'a' then 'apple' when 'b' then 'baseball' when 'c' then 'cookie' end as code from test //
+----------+
| code |
+----------+
| apple |
| baseball |
| cookie |
+----------+
3 rows in set (0.00 sec)
OK with 3 elements but a bit long winded if you had many more, but does the job none the less.
Andrew Gilfrin
MySQL Stroed Procedure Tutorials and info at
http://www.mysqldevelopment.com