Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 353372E2DFB for ; Mon, 7 Jan 2008 18:27:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 90940-01 for ; Mon, 7 Jan 2008 18:27:38 -0400 (AST) Received: from web31804.mail.mud.yahoo.com (web31804.mail.mud.yahoo.com [68.142.207.67]) by postgresql.org (Postfix) with SMTP id CD4CA2E3596 for ; Mon, 7 Jan 2008 18:27:41 -0400 (AST) Received: (qmail 756 invoked by uid 60001); 7 Jan 2008 22:27:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Message-ID; b=4HF416afOb3E/fHg5ngRZunZnj6sJxKT5FghTWlvOV8kLILxGOPtw/HBdW3gyEAIZiEbWrNpsFsxfjsIho7eVZ++Y0q+MveWwnHxzXIvDo9F3Zx/0k4Z5z8ffSF51o+jz3gJO96DkBz9Z0kHxw15mqjP08f+yvSCLZqq0FPWqNw=; X-YMail-OSG: UfEAL7cVM1n4GF72..4ZubHNXQP_1d6Pq1E61RRBH.pLM5TVmPBtRAJ56_GQd6iK_.iQkg-- Received: from [12.180.237.138] by web31804.mail.mud.yahoo.com via HTTP; Mon, 07 Jan 2008 14:27:40 PST X-Mailer: YahooMailWebService/0.7.162 Date: Mon, 7 Jan 2008 14:27:40 -0800 (PST) From: Richard Broersma Jr Subject: Re: Get the max(value1, value2, value3) from a table To: emilu@encs.concordia.ca, Scott Marlowe Cc: pgsql-sql@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Message-ID: <239138.99803.qm@web31804.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/35 X-Sequence-Number: 29888 --- On Mon, 1/7/08, Scott Marlowe wrote: > select max(col1) from table > union all > select max(col2) from table > union all > select max(col3) from table Would the following work also? SELECT MAX( GREATEST( col1, col2, col3 ) ) FROM TABLE; Regards, Richard Broersma Jr.