I have a column (SERVICE_ID
) in my table where I can have only 3 values: 0, 1 and 2.
On a SELECT
, I'd like to change those values into English words for display:
select client, SERVICE_ID
from customers
Currently displays:
| John | 1
| Mike | 0
| Jordan | 1
| Oren | 2
I'd like to change the query to get:
| John | QA
| Mike | development
| Jordan | QA
| Oren | management
There is any way to do this using only the select?
SELECT client,
CASE SERVICE_ID
WHEN 0 THEN 'development'
WHEN 1 THEN 'QA'
WHEN 2 THEN 'management'
END AS SERVICE
FROM customers
Though I'd have a separate table for Services
with columns SERVICE_ID, Name
and join onto that to retrieve the service name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With