Combine/trim records

From: Michael Stoyanovich <mstoyanovich(at)strategy-network(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Combine/trim records
Date: 2004-01-20 19:56:47
Message-ID: BC32F22F.1BA7%mstoyanovich@strategy-network.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

I have a table of log entries (each record represents 15 minutes). I'd like
to combine adjacent entries when the project id (pid) is the same. Any
suggestions on how to combine/trim these records with Postgres? Or any other
non PG solution?

Before:
LogID Date StartTime EndTime Duration PID Description
10001 2004-01-16 08:00:00 08:15:00 0.25 1 foo
10002 2004-01-16 08:15:00 08:30:00 0.25 1 bar

After:
LogID Date StartTime EndTime Duration PID Description
10001 2004-01-16 08:00:00 08:30:00 0.5 1 foo
bar

Thank you in advance...

--
Michael Stoyanovich
Strategy Network Inc.
mstoyanovich(at)strategy-network(dot)com

Browse pgsql-php by date

  From Date Subject
Next Message Chalrie Schaubmair 2004-01-25 17:06:15 Re: Can't connect to phppgadmin
Previous Message scott.marlowe 2004-01-20 17:59:05 Re: Triggers, Rules and email