Sort NULL values to the end of a table

前端 未结 2 1044
囚心锁ツ
囚心锁ツ 2020-12-02 16:15

Is there a way with PostgreSQL to sort rows with NULL values in fields to the end of the selected table?

Like:

SELECT * FROM table ORDER         


        
2条回答
  •  萌比男神i
    2020-12-02 16:52

    Does this make the trick?

    ORDER BY somevalue DESC NULLS LAST
    

    Taken from: http://www.postgresql.org/docs/9.0/static/sql-select.html

提交回复
热议问题