Received: from mail.enterprise.net (mail.enterprise.net [194.72.192.18]) by hub.org (8.10.1/8.10.1) with ESMTP id e5NGES168556 for ; Fri, 23 Jun 2000 12:14:28 -0400 (EDT) Received: from linda.lfix.co.uk (cmax05-021.enterprise.net [212.161.115.21]) by mail.enterprise.net (8.8.5/8.8.5) with ESMTP id RAA12542; Fri, 23 Jun 2000 17:14:25 +0100 (GMT/BST) Received: from lfix.co.uk (olly@localhost [127.0.0.1]) by linda.lfix.co.uk (8.11.0.Beta1/8.11.0.Beta1/Debian 8.11.0-1) with ESMTP id e5NG7Ke23404; Fri, 23 Jun 2000 17:07:20 +0100 Message-Id: <200006231607.e5NG7Ke23404@linda.lfix.co.uk> X-Authentication-Warning: linda.lfix.co.uk: Host olly@localhost [127.0.0.1] claimed to be lfix.co.uk X-Mailer: exmh version 2.1.1 10/15/1999 (debian) To: "Mitch Vincent" cc: pgsql-sql@postgresql.org, olly@linda.lfix.co.uk Subject: Re: Orderby two different columns In-Reply-To: Message from "Mitch Vincent" of "Fri, 23 Jun 2000 10:29:59 -0400." <005d01bfdd1f$8359fa60$0300000a@doot.org> References: <005d01bfdd1f$8359fa60$0300000a@doot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 23 Jun 2000 17:07:20 +0100 From: "Oliver Elphick" X-Archive-Number: 200006/212 "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