Re: writing a MIN(RECORD) aggregate - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: writing a MIN(RECORD) aggregate
Date
Msg-id 87ve3an49h.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: writing a MIN(RECORD) aggregate  (Sam Mason <sam@samason.me.uk>)
Responses Re: writing a MIN(RECORD) aggregate
List pgsql-hackers
"Sam Mason" <sam@samason.me.uk> writes:

> On Mon, Mar 24, 2008 at 05:27:04PM -0500, Decibel! wrote:
>> On Mar 20, 2008, at 2:23 PM, Sam Mason wrote:
>> >  SELECT i, (MIN((j,k))).k
>> >  FROM tbl
>> >  GROUP BY i;
>> 
>> How is that any better than SELECT i, min(k) FROM tbl GROUP BY i ?
>
> Because I want the value of k associated with the minimum value of j.
> For example, if I have data looking like:

I have nothing against having min(record) and it does seem like it would let
you do this at least for reasonably simple cases.

But I'm more eager to see full OLAP window functions which would let you do
this and a whole lot else as well.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's RemoteDBA services!


pgsql-hackers by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: TRUNCATE TABLE with IDENTITY
Next
From: Bruce Momjian
Date:
Subject: Re: TRUNCATE TABLE with IDENTITY