Orderby two different columns

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Orderby two different columns
Date: 2000-06-23 14:29:59
Message-ID: 005d01bfdd1f$8359fa60$0300000a@doot.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mitch Vincent 2000-06-23 14:53:41 Re: Need to improve performance
Previous Message Vassili A Akimov 2000-06-23 14:27:18 Need to improve performance