Reputation: 8111
Is there a way to show different strings based on value found in a column?
i.e.
SELECT value FROM table;
+--------+
| value |
+--------+
| 1 |
| 0 |
| 1 |
| 1 |
+--------+
The output I want is this:
+--------+
| value |
+--------+
| yes |
| no |
| yes |
| yes |
+--------+
How?
Upvotes: 4
Views: 5458
Reputation: 1269973
A fun way to do this uses elt()
:
select elt(value + 1, 'no', 'yes')
elt()
returns the nth string based on the first argument.
Upvotes: 5