"Eric G. Miller" <egm2(at)jps(dot)net> writes:
> Looking for the best way to formulate a query to select
> the most "recent" entry for an organization in a table
> like:
Take a look at the SELECT reference page's example for
SELECT DISTINCT ON:
: For example,
:
: SELECT DISTINCT ON (location) location, time, report
: FROM weatherReports
: ORDER BY location, time DESC;
:
: retrieves the most recent weather report for each location.
A tad nonstandard, but bloody effective, particularly if you
have an appropriate index in place...
regards, tom lane