Subject select multiple max
Author korkless
hi all, i have this table

RESULTS
{
integer ID //PK
integer SOURCE_ID //FK
timestamp DATE
}

i need to select this set

[SOURCE_ID, ID]

where ID is the id of the row witht row.SOURCE_ID = SOURCE_ID
and wich have the last timestamp.

(ie i need to do this query
SELECT FIRST 1 r.ID from RESULTS r
WHERE r.SOURCE_ID = :SourceId
ORDER BY r.DATE DESC
for each distict SOURCE_ID)

what's the best way to do that? thanks