Re: Selecting distinct records

Поиск
Список
Период
Сортировка
От Dave [Hawk-Systems]
Тема Re: Selecting distinct records
Дата
Msg-id DBEIKNMKGOBGNDHAAKGNGEGGDPAB.dave@hawk-systems.com
обсуждение исходный текст
Ответ на Selecting distinct records  ("Dave [Hawk-Systems]" <dave@hawk-systems.com>)
Ответы Re: Selecting distinct records  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
>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...

is you do a sum() or order by in the select statement you get and error,  for
example;

select distinct on (sessionid) sum(sessiontime) from logs where
name='joeblowuser' and datetime > 1036040400;

ERROR:  Attribute logs.sessionid must be GROUPed or used in an aggregate
function

Same if you have to order by datetime or something...

Dave



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

Предыдущее
От: Egyud Csaba
Дата:
Сообщение: Re: Welcom & a problem
Следующее
От: "Williams, Travis L, NPONS"
Дата:
Сообщение: Re: tcpip connections..