MySQL Orderby a number, Nulls last

前端 未结 12 2536
再見小時候
再見小時候 2020-11-22 16:57

Currently I am doing a very basic OrderBy in my statement.

SELECT * FROM tablename WHERE visible=1 ORDER BY position ASC, id DESC

The probl

12条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 17:32

    I found this to be a good solution for the most part:

    SELECT * FROM table ORDER BY ISNULL(field), field ASC;
    

提交回复
热议问题