MySQL 排序时如何把0放最后, 其它按照从小到大排序
1 SELECT * FROM banner ORDER BY CASE when sort<>0 then sort else 99999 end asc; 2 SELECT * FROM banner ORDER BY CASE when sort<>0 then sort else 99999 end desc; 3 4 SELECT * FROM banner ORDER BY sort = 0,sort asc; 5 SELECT * FROM banner ORDER BY sort = 0,sort desc; 6 7 上面两种方法都可以的