pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: need to join successive log entries into one
Date: Wed, 14 Mar 2001 17:01:43 -0600
Message-ID: <20010314170143.A30281@rice.edu> (raw)
In-Reply-To: <20010314.21173300@client.archonet.com>
References: <01031413092300.02477@pen>
	<20010314.21173300@client.archonet.com>

On Wed, Mar 14, 2001 at 09:17:33PM +0000, Richard H wrote:
> 
> > 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;

 select run,min(start),max(done) from mytable group by run
	UNION ALL
 select run,start,NULL from mytable where done is null;

Assuming that any given run has only one open step.

Ross



view thread (6+ messages)  latest in thread

Message-ID: <20010314170143.A30281@rice.edu>
Permalink:  ../20010314170143.A30281@rice.edu/
Also on:    postgresql.org/message-id/20010314170143.A30281@rice.edu

 · 

reply

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: reedstrm@rice.edu
  Subject: Re: need to join successive log entries into one
  In-Reply-To: <20010314170143.A30281@rice.edu>
  References: <01031413092300.02477@pen> <20010314.21173300@client.archonet.com> <20010314170143.A30281@rice.edu>

* 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