Re: writing a MIN(RECORD) aggregate

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: writing a MIN(RECORD) aggregate
Date: 2008-03-25 18:58:06
Message-ID: 87fxuemy0x.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Sam Mason" <sam(at)samason(dot)me(dot)uk> writes:

> SELECT i, MIN(k) OVER (PARTITION BY j)
> FROM tbl
> GROUP BY i;
>
> This is obviously wrong, but I don't see how to get to where I need to
> be.

I'm not entirely sure myself. I think it might involve RANK OVER j though.

I suspect it will look more like the DISTINCT ON solution than the min(record)
solution.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kurt Roeckx 2008-03-25 19:00:44 Re: gcc 4.3 breaks ContribCheck in 8.2 and older.
Previous Message Alvaro Herrera 2008-03-25 18:29:32 Re: Wiki patch queue