SELECT * FROM t_table ORDER BY case
WHEN field1 like '%字符串1%' then 4
WHEN field1 like '%字符串2%' then 2
WHEN field1 like '%字符串3%' then 3
end
asc
mysql按照指定的字段中某些字符串进行排序
最新推荐文章于 2022-09-14 17:55:12 发布
SELECT * FROM t_table ORDER BY case
WHEN field1 like '%字符串1%' then 4
WHEN field1 like '%字符串2%' then 2
WHEN field1 like '%字符串3%' then 3
end
asc