I\'m looking for a string function that works like Oracle\'s DECODE Having table tab with a single column col
tab
col
col ---- a b c d
You could write a nested if statement.
if
Query:
select col , if(col='a', 1, if(col='b', 2, 9)) dec from table
Output:
--------- col | dec --------- a 1 b 2 c 9 d 9