21,882
社区成员
发帖
与我相关
我的任务
分享
SELECT `id`,`status` ORDER BY FIELD(`status`,'2','5','0'),`status` DESC
field函数是自定义排序
(select * from table where status=2 order by id desc) unicon all (select * from table where status=5 order by id desc) unicon all(select * from table where status=0 order by id desc);
SELECT
`id`,
`status`,
CASE `status`
WHEN 2 THEN
8
ELSE
`status`
END AS kkk
FROM
a
ORDER BY
kkk DESC,
`id` DESC