Re: help formualting a query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: stan <stanb(at)panix(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: help formualting a query
Date: 2019-09-08 23:23:47
Message-ID: 22058.1567985027@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

stan <stanb(at)panix(dot)com> writes:
> I have a table that contains a series of rows. Each row has a project key,
> a start date, and an end date. There are multiple rows with different start
> and end dates for each project.

> I need to return something that contains, one row per project key, with the
> min(star date) and max(end date) for ALL the records for that given
> project.

Maybe I'm misunderstanding something, but isn't this just

select project_key, min(start_date), max(end_date)
from my_table
group by project_key

??

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2019-09-09 04:16:55 Re: floating point output
Previous Message stan 2019-09-08 23:11:36 help formualting a query