From: Michael Glaesemann <grzm@seespotcode.net>
To: depesz@depesz.com
Cc: Claudia Kosny <ckosny@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: fetch first rows of grouped data
Date: Tue, 28 Aug 2007 08:00:42 -0500
Message-ID: <2A02E93C-62E7-4D94-8559-B0999835698F@seespotcode.net> (raw)
In-Reply-To: <20070828091421.GB19637@depesz.com>
References: <46D2FD9F.3020000@gmx.net>
<20070828091421.GB19637@depesz.com>
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
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: grzm@seespotcode.net, depesz@depesz.com, ckosny@gmx.net
Subject: Re: fetch first rows of grouped data
In-Reply-To: <2A02E93C-62E7-4D94-8559-B0999835698F@seespotcode.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