Re: Selecting distinct records

From: "Dave" <dave(at)hawk-systems(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Selecting distinct records
Date: 2002-11-21 18:43:15
Message-ID: DBEIKNMKGOBGNDHAAKGNMEGGDPAB.dave@hawk-systems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

>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

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message David Busby 2002-11-21 19:02:05 Re: Selecting distinct records
Previous Message Dave [Hawk-Systems] 2002-11-21 18:03:10 Selecting distinct records