View Single Post

   
  #4 (permalink)  
Old 04-15-2008, 10:48 PM
Gregory Stark
 
Posts: n/a
Default Re: writing a MIN(RECORD) aggregate

"Sam Mason" <sam@samason.me.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!

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply With Quote