Back

postgres - 排序时,对于string类型的列,不能简单的order by xx asc , 会发现null排在首位

发布时间: 2023-05-07 09:13:00

refer to:

https://stackoverflow.com/questions/7621205/sort-null-values-to-the-end-of-a-table

需要使用语句: order by xx desc nulls last

上面的 nulls  last就表示,把nulls 的值放到最后。 (也可以改成first)

Back