X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2A2B5310CDB for ; Tue, 1 Jul 2003 20:18:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 19376-07 for ; Tue, 1 Jul 2003 17:18:27 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 3ADE7310B57 for ; Tue, 1 Jul 2003 17:18:27 -0300 (ADT) Received: (qmail 4515 invoked by uid 500); 1 Jul 2003 20:22:07 -0000 Date: Tue, 1 Jul 2003 15:22:07 -0500 From: Bruno Wolff III To: Greg Stark Cc: Josh Berkus , Stefan Bill , pgsql-sql@postgresql.org Subject: Re: LEAST and GREATEST functions? Message-ID: <20030701202207.GA4463@wolff.to> Mail-Followup-To: Greg Stark , Josh Berkus , Stefan Bill , pgsql-sql@postgresql.org References: <20030630201057.14507.qmail@web13905.mail.yahoo.com> <200306302032.23113.josh@agliodbs.com> <87d6gu2otf.fsf@stark.dyndns.tv> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d6gu2otf.fsf@stark.dyndns.tv> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/20 X-Sequence-Number: 14134 On Tue, Jul 01, 2003 at 12:29:16 -0400, Greg Stark wrote: > > SELECT greatest(a,b) FROM bar > > would return one tuple for every record in the table with a single value > representing the greater of bar.a and bar.b. You can do this with case. SELECT CASE WHEN a >= b THEN a ELSE b END FROM bar;