gpt4 book ai didi

php - 选择自定义结果

转载 作者:太空宇宙 更新时间:2023-11-03 12:09:57 24 4
gpt4 key购买 nike

我在数据库中有:

City:
id | name | type
1 | London | A
2 | Manchester | E
3 | Cardiff | W

我想通过选择接收:

1  | London     | First
2 | Manchester | Second
3 | Cardiff | Third

所以查询应该将 A 替换为 First,E 替换为 Second,W 替换为 Third。

SELECT id, name, type ???? FROM City

我怎样才能做到?

最佳答案

select id,
name,
case when type = 'A' then 'First'
when type = 'E' then 'Second'
when type = 'W' then 'Third'
end as alias_name
from City

关于php - 选择自定义结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24737889/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com