From: Oliver Elphick <olly@lfix.co.uk>
To: Mitch Vincent <mitch@venux.net>
Cc: pgsql-sql@postgresql.org
Cc: olly@linda.lfix.co.uk
Subject: Re: Orderby two different columns
Date: Fri, 23 Jun 2000 17:07:20 +0100
Message-ID: <200006231607.e5NG7Ke23404@linda.lfix.co.uk> (raw)
In-Reply-To: <mitch@venux.net> <005d01bfdd1f$8359fa60$0300000a@doot.org>
References: <m135JRS-000AY3C@druid.net>
<005d01bfdd1f$8359fa60$0300000a@doot.org>
"Mitch Vincent" wrote:
>I need to order search results by the two dates. Here is the problem..
>
>They want whichever date is the most recent to appear on top.. If I do
>'order by resubmitted desc,created desc' I get something like this :
>
>Applicant Re-submitted Created
>A 06/05/2000 12/31/1999
>B 06/05/2000 12/31/1999
>C 05/17/2000 02/09/2000
>D 05/17/2000 01/21/2000
>E 05/11/2000 01/27/2000
>F 05/11/2000 01/21/2000
>G 05/01/2000 12/31/1999
>H 04/28/2000 01/28/2000
>I 04/28/2000 01/12/2000
>J 05/23//2000
>
>
>Ok, see applicant J? I need him to be above C..
select * from table
order by case
when resubmitted > created then resubmitted
else created
end
desc;
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Train up a child in the way he should go, and when he
is old, he will not depart from it." Proverbs 22:6
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: olly@lfix.co.uk, mitch@venux.net, olly@linda.lfix.co.uk
Subject: Re: Orderby two different columns
In-Reply-To: <200006231607.e5NG7Ke23404@linda.lfix.co.uk>
References: <m135JRS-000AY3C@druid.net> <005d01bfdd1f$8359fa60$0300000a@doot.org> <200006231607.e5NG7Ke23404@linda.lfix.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox