Re: help formualting a query - Mailing list pgsql-general

From Tom Lane
Subject Re: help formualting a query
Date
Msg-id 22058.1567985027@sss.pgh.pa.us
Whole thread Raw
In response to help formualting a query  (stan <stanb@panix.com>)
List pgsql-general
stan <stanb@panix.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



pgsql-general by date:

Previous
From: stan
Date:
Subject: help formualting a query
Next
From: Rob Sargent
Date:
Subject: Re: floating point output