Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e5NFx6132652 for ; Fri, 23 Jun 2000 11:59:06 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id LAA18712; Fri, 23 Jun 2000 11:59:04 -0400 (EDT) To: "Mitch Vincent" cc: pgsql-sql@postgresql.org Subject: Re: Orderby two different columns In-reply-to: <005d01bfdd1f$8359fa60$0300000a@doot.org> References: <005d01bfdd1f$8359fa60$0300000a@doot.org> Comments: In-reply-to "Mitch Vincent" message dated "Fri, 23 Jun 2000 10:29:59 -0400" Date: Fri, 23 Jun 2000 11:59:03 -0400 Message-ID: <18709.961775943@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200006/211 "Mitch Vincent" 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