| From: | "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: need to join successive log entries into one |
| Date: | 2001-03-14 23:01:43 |
| Message-ID: | 20010314170143.A30281@rice.edu |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Oliver Elphick | 2001-03-14 23:03:01 | Re: PIVOT of data |
| Previous Message | George Young | 2001-03-14 22:30:52 | Re: need to join successive log entries into one |