mysql按照某个字段排序,该字段为空要排在最后
解决方法:
方法一:
select * from table order by case when ifnull(sortnum,'')='' then 0 else 1 end desc, sortnum asc;
方法二:
select * from table order by sortnum is null,sortnum asc;
mysql按照某个字段排序,该字段为空要排在最后
解决方法:
方法一:
select * from table order by case when ifnull(sortnum,'')='' then 0 else 1 end desc, sortnum asc;
方法二:
select * from table order by sortnum is null,sortnum asc;
有建议,请留言!