From: Dave <dave@hawk-systems.com>
To: pgsql-php@postgresql.org
Subject: Re: Selecting distinct records
Date: Thu, 21 Nov 2002 13:43:15 -0500
Message-ID: <DBEIKNMKGOBGNDHAAKGNMEGGDPAB.dave@hawk-systems.com> (raw)
In-Reply-To: <DBEIKNMKGOBGNDHAAKGNKEFODPAB.dave@hawk-systems.com>
>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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: dave@hawk-systems.com
Subject: Re: Selecting distinct records
In-Reply-To: <DBEIKNMKGOBGNDHAAKGNMEGGDPAB.dave@hawk-systems.com>
References: <DBEIKNMKGOBGNDHAAKGNKEFODPAB.dave@hawk-systems.com> <DBEIKNMKGOBGNDHAAKGNMEGGDPAB.dave@hawk-systems.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox