SELECT `id`, `status`, CASE `status` WHEN 2 THEN 8 ELSE `status` END AS kkk FROM a ORDER BY kkk DESC, `id` DESC
select * form tbl_name order by status=2 desc, id desc
(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` ORDER BY FIELD(`status`,'2','5','0'),`status` DESC field函数是自定义排序
`id`,
`status`,
CASE `status`
WHEN 2 THEN
8
ELSE
`status`
END AS kkk
FROM
a
ORDER BY
kkk DESC,
`id` DESC
(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);
field函数是自定义排序