Forespørgsel:
SELECT table_id, series_id, revision_id, yearFROM tableName t INNER JOIN (SELECT revision_id, max(year) AS year FROM tableName WHERE series_id =2 GROUP BY revision_id) sUSING (revision_id, year)WHERE series_id =2;
Resultat:
tabel_id | serie_id | revision_id | år----------------------------------- 2 | 2 | 1 | 2009 4 | 2 | 2 | 2009 5 | 2 | 3 | 2010(3 rækker)