Re: the best way to get the first record from each group - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: the best way to get the first record from each group
Date
Msg-id 20050208011626.GA43996@winnie.fuhr.org
Whole thread Raw
In response to the best way to get the first record from each group  ("q2005" <q2005@tpg.com.au>)
List pgsql-sql
On Tue, Feb 08, 2005 at 10:36:17AM +1000, q2005 wrote:
>
> Is there any better alternative to get the first record from each group?

PostgreSQL has a non-standard SELECT DISTINCT ON query for just
this purpose.

http://www.postgresql.org/docs/8.0/static/queries-select-lists.html#QUERIES-DISTINCT
http://www.postgresql.org/docs/8.0/static/sql-select.html#SQL-DISTINCT

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


pgsql-sql by date:

Previous
From: "q2005"
Date:
Subject: the best way to get the first record from each group
Next
From: "Premsun Choltanwanich"
Date:
Subject: Re: How can I use large object on PostgreSQL Linux