Re: Overriding natural order of query results for a subset

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch>
Cc: 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:48:18
Message-ID: CAOzAquLQZf5UUVBK+Hbe7R3girfdTBh7bnHEPC2W0MpSqwRRnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, May 29, 2021 at 9:15 AM Laura Smith <
n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> wrote:

> Hi
>
> I've got a bit of a puzzle that I'm not quite sure how to approach.
>
> Let's say I've got a table of bios, so :
>
> create table bios (
> first_name text not null,
> last_name text not null,
> person_title text,
> person_short_bio text
> )
>

You don't have a VIP field, so how do you know who's a VIP and who isn't
much less who's a VVIP? Is that information buried in the title and short
bio fields?

You probably need some kind order by case when .... else .... end clause,
where the else clause deals with the non-VIPs, probably negating the need
for a nulls last clause.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-05-29 16:55:54 Re: Overriding natural order of query results for a subset
Previous Message Adrian Klaver 2021-05-29 16:44:14 Re: Overriding natural order of query results for a subset