Re: Overriding natural order of query results for a subset

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Overriding natural order of query results for a subset
Дата
Msg-id a20f32d7-a1de-89c6-ef5e-6141086dc313@aklaver.com
обсуждение исходный текст
Ответ на Re: Overriding natural order of query results for a subset  (Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>)
Список pgsql-general
On 5/29/21 9:34 AM, Laura Smith wrote:
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> On Saturday, 29 May 2021 17:06, Adrian Klaver <adrian.klaver@aklaver.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,
mostof 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@aklaver.com



В списке pgsql-general по дате отправления:

Предыдущее
От: Laura Smith
Дата:
Сообщение: Re: Overriding natural order of query results for a subset
Следующее
От: Michael Nolan
Дата:
Сообщение: Re: Overriding natural order of query results for a subset