Thread: Combine/trim records

Combine/trim records

From
Michael Stoyanovich
Date:
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@strategy-network.com