Re: Improve a query... - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Improve a query...
Date
Msg-id Pine.LNX.4.30.0105021929290.759-100000@peter.localdomain
Whole thread Raw
In response to Improve a query...  ("Eric G. Miller" <egm2@jps.net>)
List pgsql-general
Eric G. Miller writes:

> If max(period) for an organization yields the most recent reporting,
> I want to get whatever is the most recent report for each organization.

SELECT org_id, max(period) FROM reports GROUP BY org_id;

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: Randall Perry
Date:
Subject: Perl Scope problem
Next
From: DaVinci
Date:
Subject: Views and Rules again