gpt4 book ai didi

mysql - 如何按手动顺序取一些行,然后按常规方式休息

转载 作者:行者123 更新时间:2023-11-29 04:33:06 25 4
gpt4 key购买 nike

我正在从数据库中获取国家/地区,并希望将其中一些手动添加到开头。该列表应如下所示:

Y <- those rows should be chosen by hand
X
R
A <- and the rest is going to be in the regular order
B
C
D

最佳答案

您可以使用 case 表达式:

select t.*
from t
order by (case when col = 'Y' then 1
when col = 'X' then 2
when col = 'R' then 3
else 4
end),
col;

关于mysql - 如何按手动顺序取一些行,然后按常规方式休息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53724084/

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