From: Emi Lu <emilu@encs.concordia.ca>
To: Richard Broersma Jr <rabroersma@yahoo.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Get the max(value1, value2, value3) from a table
Date: Mon, 07 Jan 2008 17:37:56 -0500
Message-ID: <4782A9C4.1030104@encs.concordia.ca> (raw)
In-Reply-To: <239138.99803.qm@web31804.mail.mud.yahoo.com>
References: <239138.99803.qm@web31804.mail.mud.yahoo.com>
>
>> select max(col1) from table
>> union all
>> select max(col2) from table
>> union all
>> select max(col3) from table
No, this is not what I prefer; it makes complicate query.
>
> Would the following work also?
>
> SELECT MAX( GREATEST( col1, col2, col3 ) )
> FROM TABLE;
I would prefer this func. Unfortunately, the current version I have
8.02(http://www.postgresql.org/docs/8.0/static/functions-conditional.html)
does not support this func I am afraid :(
Thanks !
Ly.
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: emilu@encs.concordia.ca, rabroersma@yahoo.com, scott.marlowe@gmail.com
Subject: Re: Get the max(value1, value2, value3) from a table
In-Reply-To: <4782A9C4.1030104@encs.concordia.ca>
* 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