select * from tb order by case when 序号!=0 then 1 else 2 end,id select * from tb order by case when 序号!=0 then 序号 else 5 end asc,id