Re: Grouping logs by ip and time - Mailing list pgsql-general

From John R Pierce
Subject Re: Grouping logs by ip and time
Date
Msg-id 4EB97BA0.5080300@hogranch.com
Whole thread Raw
In response to Re: Grouping logs by ip and time  (Raymond O'Donnell <rod@iol.ie>)
Responses Re: Grouping logs by ip and time  (Ascarabina <ascarabina@gmail.com>)
List pgsql-general
On 11/08/11 10:48 AM, Raymond O'Donnell wrote:
> Would something like this work? -
>
>    select ip, max("time") - min("time") as session_duration
>    from log_table
>    group by ip;
>
> This doesn't take the date into account - what happens if the session
> spans midnight? You can get around this by using a timestamp column
> instead of separate date and time.

he said a session always starts with 'action1', and presumably there can
be more than one session per day, so this won't work.  the 'end' of a
session is presumably the previous action2|3|4|5 thats prior to the next
action1.     I have no idea how you'd code this as a SQL query.





--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: Grouping logs by ip and time
Next
From: Ascarabina
Date:
Subject: Re: Grouping logs by ip and time