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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general