Orderby two different columns - Mailing list pgsql-sql

From Mitch Vincent
Subject Orderby two different columns
Date
Msg-id 005d01bfdd1f$8359fa60$0300000a@doot.org
Whole thread Raw
In response to Re: Using substr with user defined types  (darcy@druid.net (D'Arcy J.M. Cain))
Responses Re: Orderby two different columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Orderby two different columns  ("Oliver Elphick" <olly@lfix.co.uk>)
List pgsql-sql
I ran into a problem today that I hope someone can help me with...

I have a database (and application) that is used to track 'applicants'..
These applicants have two timestamp fields associated with their records and
both have relevance as to how long the applicant has been available..

The resubmitted field s of type timestamp and has a default value of  'Sat
Oct 02 00:00:00 1999 EDT'

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.. Basically what I need to do
is order by a combination of date created/resubmitted -- the way I'm doing
it now is going to list al the resubmitted's in order, then all the
created's in order.. Perhaps I'm just missing something simple, I sure hope
so..

Hopefully I've explained it well enough. Thanks for any suggestions!!!

-Mitch











pgsql-sql by date:

Previous
From: darcy@druid.net (D'Arcy J.M. Cain)
Date:
Subject: Re: Merging two columns into one
Next
From: Vassili A Akimov
Date:
Subject: Need to improve performance