Search Postgresql Archives

Re: Overriding natural order of query results for a subset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/29/21 9:34 AM, Laura Smith wrote:

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, 29 May 2021 17:06, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:

On 5/29/21 9:00 AM, Laura Smith wrote:

I did try "nulls last" but will give it another go, maybe I messed up on the ordering of clauses.

Unless the fields you are ordering on contain NULLs I'm not sure how
this is going to deal with your issue.



Reading between the lines of the poster who suggested it, I'm guessing the suggestion was to add an "int" column, most of which is null except for numbers where needed for ordering and then having "order by vip_num_order,order by last_name" in my select clause.


That's a whole lot of reading:) If you are going to go that route use NOT NULL and a DEFAULT of 0. Then you are not depending on a lack of information and you can use explicit number setting to create your ordering.

--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux