Re: Improve a query...

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Eric G(dot) Miller" <egm2(at)jps(dot)net>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Improve a query...
Date: 2001-05-02 17:30:13
Message-ID: Pine.LNX.4.30.0105021929290.759-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2001-05-02 17:43:03 RE: Joining more than 2 tables
Previous Message Peter Eisentraut 2001-05-02 17:26:18 Re: Serial Type