Re: Overriding natural order of query results for a subset - Mailing list pgsql-general

From Michael Nolan
Subject Re: Overriding natural order of query results for a subset
Date
Msg-id CAOzAquLQZf5UUVBK+Hbe7R3girfdTBh7bnHEPC2W0MpSqwRRnQ@mail.gmail.com
Whole thread Raw
In response to Overriding natural order of query results for a subset  (Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.ch>)
Responses Re: Overriding natural order of query results for a subset
List pgsql-general


On Sat, May 29, 2021 at 9:15 AM Laura Smith <n5d9xq3ti233xiyif2vp@protonmail.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. 

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Overriding natural order of query results for a subset
Next
From: Tom Lane
Date:
Subject: Re: Overriding natural order of query results for a subset