From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mitch Vincent <mitch@venux.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Orderby two different columns
Date: Fri, 23 Jun 2000 11:59:03 -0400
Message-ID: <18709.961775943@sss.pgh.pa.us> (raw)
In-Reply-To: <005d01bfdd1f$8359fa60$0300000a@doot.org>
References: <m135JRS-000AY3C@druid.net>
<005d01bfdd1f$8359fa60$0300000a@doot.org>
"Mitch Vincent" <mitch@venux.net> writes:
> Ok, see applicant J? I need him to be above C.
Your example was about as transparent as mud, but maybe you are looking
to sort on MAX(resubmitted, created) or something like that? Anyway
I'd think that sorting on some function of the two dates is probably
what you need to do.
I don't think we have a two-input MAX function like that, but it'd be
easy enough to fake it with a CASE expression. Something like
... ORDER BY (CASE WHEN a > b THEN a ELSE b END) DESC;
regards, tom lane
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: tgl@sss.pgh.pa.us, mitch@venux.net
Subject: Re: Orderby two different columns
In-Reply-To: <18709.961775943@sss.pgh.pa.us>
References: <m135JRS-000AY3C@druid.net> <005d01bfdd1f$8359fa60$0300000a@doot.org> <18709.961775943@sss.pgh.pa.us>
* 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