Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 4C4E12E4309 for ; Mon, 7 Jan 2008 18:43:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 29328-02-3 for ; Mon, 7 Jan 2008 18:43:15 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.176]) by postgresql.org (Postfix) with ESMTP id CDE482E42F6 for ; Mon, 7 Jan 2008 18:43:28 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so13172430waf.5 for ; Mon, 07 Jan 2008 14:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=x5Be96rDJEqVvBCQmGO6rys9ZOloz3lx0aE864jYxTI=; b=HfFaMU5qkNZ8yB5iiY/90h+EJp96uAo/EL1PAeTcEtHQtGcGrV/9w3KHxdbCCScQP2x8lDM1oa/yePpopxNZrq+x2JE7yKzSdrRWEzRhmq3g7IcCY4kSEEmGQs+DUgnojgpC95SiLXwPhaYwInho1/PWzyIbF8zLXEWT738cqOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=plxdQw6nsQ6gC89GkqV/FXoXJprNEPR14qKGEnozVmEJjO/C/9Eg4VPy98oCDOEOWLgncPH/ej13K2kruMMUFE5E7BABAZdUm07KON4GVLUTLpAVnIUXOZM86QAfqhvhadvlQ10ED+04erUVmahG6zMauD7lmoUMy+J4JkYyAjg= Received: by 10.114.109.1 with SMTP id h1mr6480925wac.45.1199745807591; Mon, 07 Jan 2008 14:43:27 -0800 (PST) Received: by 10.114.131.4 with HTTP; Mon, 7 Jan 2008 14:43:27 -0800 (PST) Message-ID: Date: Mon, 7 Jan 2008 16:43:27 -0600 From: "Scott Marlowe" To: "Josh Williams" Subject: Re: Get the max(value1, value2, value3) from a table Cc: emilu@encs.concordia.ca, pgsql-sql@postgresql.org In-Reply-To: <1199745537.5877.9.camel@godzilla.local.scalefeather.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4782A1B2.5050804@encs.concordia.ca> <1199745537.5877.9.camel@godzilla.local.scalefeather.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/40 X-Sequence-Number: 29893 On Jan 7, 2008 4:38 PM, Josh Williams wrote: > On Mon, 2008-01-07 at 17:03 -0500, Emi Lu wrote: > > select ?max?(col1, col2, col3) as result; > > will return > > > > result > > ------- > > 5 > > 8 > > 12 > > > > (3 rows) > > 8.1 (I believe?) introduced GREATEST(), which does precisely what you're > looking for. How would greatest give him three rows like that? Maybe I'm misunderstanding what the OP was asking for...