From: Amos Hayes <ahayes@polkaroo.net>
To: Rod Taylor <pg@rbt.ca>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Find min and max values across two columns?
Date: Fri, 24 Mar 2006 16:34:43 -0500
Message-ID: <0C305AAF-7DA6-40BF-B118-2E63C2A27748@polkaroo.net> (raw)
In-Reply-To: <1143235206.90799.108.camel@home>
References: <DAD4674C-1896-4F24-B43B-B884491DB931@polkaroo.net>
<1143233215.90799.91.camel@home>
<10495.1143235231@sss.pgh.pa.us>
<1143235206.90799.108.camel@home>
Your tips were great and I have hunted down the relevant pages in the
docs. Thanks guys!
--
Amos
On 24-Mar-06, at 4:20 PM, Rod Taylor wrote:
> On Fri, 2006-03-24 at 16:20 -0500, Tom Lane wrote:
>> Rod Taylor <pg@rbt.ca> writes:
>>> The reason for the subselect is to prevent multiple calculations of
>>> individual column aggregates. I believe it *may* be calculated
>>> multiple
>>> times otherwise this would work just as well:
>>
>>> select case when max(a) > max(b) then max(a) else max(b) end as
>>> max from
>>> tab;
>>
>> Just for the record, we've gotten that right since 7.4. greatest()
>> would be a notationally cleaner solution than CASE, but multiple
>> occurrences of identical aggregates don't cost much of anything.
>
> Thanks. I could not remember one way or the other.
>
> --
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that
> your
> message can get through to the mailing list cleanly
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: ahayes@polkaroo.net, pg@rbt.ca, tgl@sss.pgh.pa.us
Subject: Re: Find min and max values across two columns?
In-Reply-To: <0C305AAF-7DA6-40BF-B118-2E63C2A27748@polkaroo.net>
* 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