Phillip,
> What it effectively does is executes the second SELECT for each row
> of the
> first select, a bit like a column-select expression, but it allows
> access
> to all rows.
Ah! I knew that there had to be a simple way to do what you want to do
in PGSQL:
SELECT MIN(getfile) as bestfile
FROM logs, (SELECT SID, MAX(logtime) as lasttime FROM logs) MDT
WHERE logs.SID = MDT.SID AND logs.logtime = MDT.lasttime
GROUP BY SID
This gives you the "getfile" from the logs with the latest timestamp.
In the event of two with the exact same logtime, it selects the first
one alphabetically so that you don't get two files for one SID.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete
informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small
businesses fax 621-2533 and non-profit organizations. San Francisco