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

Поиск
Список
Период
Сортировка
От Allan Kamau
Тема Re: Efficiently obtaining (any) one record per group.
Дата
Msg-id AANLkTi=dfY9RS9DU5r58qOYBB9i7XxR8g9j6ZOBT8QqK@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Efficiently obtaining (any) one record per group.  (Scott Marlowe <scott.marlowe@gmail.com>)
Список pgsql-general
On Sat, Jul 24, 2010 at 10:38 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> On Sat, Jul 24, 2010 at 12:56 AM, Allan Kamau <kamauallan@gmail.com> 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Blocked inserts on tables with FK to tables for which UPDATE has been revoked
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Prefix LIKE search and indexes issue.