On Wed, May 02, 2001 at 07:30:13PM +0200, Peter Eisentraut wrote:
> 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;
Naw, doesn't work. I need the other columns, so the GROUP BY is out
(except in a subselect). The DISTINCT ON () syntax, though
non-standard, seems to do the job.
--
Eric G. Miller <egm2@jps.net>