I want show value 1 by 'this i number one' in result of query sql. I'm looking for a statement like ALIAS but using for values, not column. Ex: id| 0| 1| 1| When excute query results sholud be: id| this is number zero| this is number one| this is number one|
Thanks!
Ex: i have table id that have 2 value 0,1. Can i using SELECT id FROM table WITH 0 AS zero AND 1 AS one;
I hope my result should be: id|zero|zero|one|...
If I correct understood, you need something like this:
with t(id) as (
select 0
union all
select 1
-- another values
)
select id as original_value,
CASE
WHEN id = 0 THEN 'zero'
WHEN id = 1 THEN 'one'
-- another values
END as changed_value
from t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.