Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id B328A2E2FD0 for ; Mon, 7 Jan 2008 18:03:36 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 18476-04 for ; Mon, 7 Jan 2008 18:03:30 -0400 (AST) Received: from perseverance.services.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by postgresql.org (Postfix) with ESMTP id 242322E2DCB for ; Mon, 7 Jan 2008 18:03:32 -0400 (AST) Received: from cacao.encs.concordia.ca (emilu@cacao.encs.concordia.ca [132.205.47.225]) by perseverance.services.encs.concordia.ca (envelope-from emilu@encs.concordia.ca) (8.13.7/8.13.7) with ESMTP id m07M3Vh4032221 for ; Mon, 7 Jan 2008 17:03:31 -0500 Message-ID: <4782A1B2.5050804@encs.concordia.ca> Date: Mon, 07 Jan 2008 17:03:30 -0500 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Get the max(value1, value2, value3) from a table Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on perseverance.encs.concordia.ca at 2008/01/07 17:03:31 EST X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/33 X-Sequence-Number: 29886 Greetings, Version: PostgreSQL 8.0.13 on i686-pc-linux-gnu I have a table test(col1, col2, col3) For each row, I'd like to get the "max"(col1, col2, col3). For example, test(1, 5, 2) test(8, 1, 3) test(12, 1, 1) select ?max?(col1, col2, col3) as result; will return result ------- 5 8 12 (3 rows) Thanks! Ly.