



























-- 自定义排序
select
FIND_IN_SET(str, 'a,b,c,d,e') as str_fis
,str
from (
select 'b' as str union all
select 'a' as str union all
select 'd' as str union all
select 'c' as str union all
select 'f' as str union all
select 'g' as str union all
select 'e' as str
) t1
order by str_fis
;

只支持可以穷举出来的,如不在范围内,则为0,会排在最前,不支持排在最后。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。