Select integer column as corresponding letter of the alphabet

Viewed 101

I have an int column that contains values no larger than about 20. I want to select as its corresponding upper case letter of the alphabet:

1 = A
2 = B
3 = C
...

I don't care what happens after Z because the column doesn't contain larger values. Is there a simple way to do this with a SQL query, to convert to a single-byte character like this?

2 Answers

Another alternative specific to MySQL using elt

select elt(col,'A','B','C','D','E','F',...);

Demo

Related