From: George Young <gry@ll.mit.edu>
To: dev@archonet.com
Cc: pgsql-sql@postgresql.org
Subject: Re: need to join successive log entries into one
Date: Wed, 14 Mar 2001 17:30:52 -0500
Message-ID: <01031417344206.02477@pen> (raw)
References: <20010314.21173300@client.archonet.com>
On Wed, 14 Mar 2001, you wrote:
> On 3/14/01, 5:24:12 PM, George Young <gry@ll.mit.edu> wrote regarding [SQL]
> I need to join successive log entries into one:
> > I have a table like:
>
> > run | seq | start | done
> > 1415| 261| 2001-01-29 12:36:55| 2001-02-07 13:02:38
> > 1415| 263| 2001-02-14 07:40:04| 2001-02-15 16:05:04
> > 1415| 264| 2001-02-16 16:05:05| 2001-03-08 16:34:03
> > 1415| 265| 2001-03-08 16:34:04|
>
> > This is a log of some operations done on some runs. 'seq' is the step
> > within the run.
>
> > I need to produce a new table that coalesces immediately successive
> > operations on a run into one, e.g.:
>
> > run | start | done
> > 1415| 2001-01-29 12:36:55| 2001-02-07 13:02:38
> > 1415| 2001-02-14 07:40:04|
> > 1747| 2001-02-15 09:14:39| 2001-03-01 09:02:39
> > 1747| 2001-03-05 13:13:58|
> > 1954| 2001-02-02 20:55:39| 2001-03-02 10:17:15
>
> Try:
>
> select run,min(start),max(done) from mytable group by run;
Alas, this combines *all* entries for a given run, not just those that
are imediately adjacent (in time, or by 'seq' number)...
--
George Young, Rm. L-204 gry@ll.mit.edu
MIT Lincoln Laboratory
244 Wood St.
Lexington, Massachusetts 02420-9108 (781) 981-2756
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-sql@postgresql.org
Cc: gry@ll.mit.edu, dev@archonet.com
Subject: Re: need to join successive log entries into one
In-Reply-To: <01031417344206.02477@pen>
References: <20010314.21173300@client.archonet.com> <01031417344206.02477@pen>
* 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