From: Josh Williams <joshwilliams@ij.net>
To: emilu@encs.concordia.ca
Cc: pgsql-sql@postgresql.org
Subject: Re: Get the max(value1, value2, value3) from a table
Date: Mon, 07 Jan 2008 17:38:57 -0500
Message-ID: <1199745537.5877.9.camel@godzilla.local.scalefeather.com> (raw)
In-Reply-To: <4782A1B2.5050804@encs.concordia.ca>
References: <4782A1B2.5050804@encs.concordia.ca>
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.
But if 8.0 is a must, you'll probably have to create your own function
to do that. Which should be fairly easy to do if you're working with a
static number of columns/data types/etc...
- Josh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: joshwilliams@ij.net, emilu@encs.concordia.ca
Subject: Re: Get the max(value1, value2, value3) from a table
In-Reply-To: <1199745537.5877.9.camel@godzilla.local.scalefeather.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox