Re: fetch first rows of grouped data

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: depesz(at)depesz(dot)com
Cc: Claudia Kosny <ckosny(at)gmx(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: fetch first rows of grouped data
Date: 2007-08-28 13:00:42
Message-ID: 2A02E93C-62E7-4D94-8559-B0999835698F@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Aug 28, 2007, at 4:14 , hubert depesz lubaczewski wrote:

> On Mon, Aug 27, 2007 at 06:36:47PM +0200, Claudia Kosny wrote:
>> Is there a way to do this with one query?
>> I am using PostgreSQL 7.4.
>
> you can try to use "distinct on".

I considered that as well, but couldn't think of a way to return more
than one row per "distinct on condition". I'd be interested to hear
if you've thought of a way to use DISTINCT ON in this situation.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Asko Oja 2007-08-28 13:00:55 Re: Database normalization
Previous Message Sebastian Ritter 2007-08-28 11:47:45 Re: Database normalization