help formualting a query

From: stan <stanb(at)panix(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: help formualting a query
Date: 2019-09-08 23:11:36
Message-ID: 20190908231136.GA17798@panix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am having a hard time figuring out to do this, the SQL way. Doing in a
procedural way with a foreach would be deasy, but I suspect that a
properly formulated SQL query can achieve this.

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.

Any suggestions?

--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-09-08 23:23:47 Re: help formualting a query
Previous Message Adrian Klaver 2019-09-08 21:11:56 Re: Convert a row to a nested JSON document containing all relations in PostgreSQL