Search Postgresql Archives

Re: Efficiently obtaining (any) one record per group.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 24, 2010 at 10:38 AM, Scott Marlowe <scott.marlowe@xxxxxxxxx> wrote:
> On Sat, Jul 24, 2010 at 12:56 AM, Allan Kamau <kamauallan@xxxxxxxxx> wrote:
>> Hi all,
>>
>> I have a large table that contains redundancies as per one field.
>>
>> I am looking for a way to identify (or extract) a non redundant set of
>> rows ( _any_ one record per group) from this table and for each record
>> of this "distinct" set of rows, I would like to capture it's other
>> fields.
>
> Would "Select distinct on ... " work for you?
>
> http://www.postgresql.org/docs/8.4/static/sql-select.html
>
> search the page for "distinct on".
>

Thank you Scott, you have made my day, this is exactly what I was looking for.

Allan.

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux