Re: Selecting distinct records

Поиск
Список
Период
Сортировка
От Dave [Hawk-Systems]
Тема Re: Selecting distinct records
Дата
Msg-id DBEIKNMKGOBGNDHAAKGNCEIKDPAB.dave@hawk-systems.com
обсуждение исходный текст
Ответ на Re: Selecting distinct records  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
>"Dave [Hawk-Systems]" <dave@hawk-systems.com> writes:
>>> What I am looking to do is
>>> - grab every record for $user
>>> - remove any records that have identical ipaddress+sessionid+refid
>>> - then sort the results by date_time or something else
>
>> this last requirement is where the problem is...
>
>I think you need two levels of select.  To do the DISTINCT ON you must
>sort by the columns to be distinct'd.  You can re-sort the result in
>an outer select.  For example:
>
>select * from
>  (select distinct on (ten) * from tenk1 order by ten) ss
>order by hundred;

is this vailable in 7.0.3, I get an error at the second select

Dave


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

Предыдущее
От: "Wright, Ryan P"
Дата:
Сообщение: Request assistance connecting with Pg::connectdb
Следующее
От: "scott.marlowe"
Дата:
Сообщение: Re: Welcom & a problem