From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> |
Cc: | Michael van der Kolff <mvanderkolff(at)gmail(dot)com>, postgre <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Overriding natural order of query results for a subset |
Date: | 2021-05-29 16:44:14 |
Message-ID: | a20f32d7-a1de-89c6-ef5e-6141086dc313@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 5/29/21 9:34 AM, Laura Smith wrote:
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, 29 May 2021 17:06, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> 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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Nolan | 2021-05-29 16:48:18 | Re: Overriding natural order of query results for a subset |
Previous Message | Laura Smith | 2021-05-29 16:34:23 | Re: Overriding natural order of query results for a subset |