「greatest-n-per-group」問題をご存知ですか?
これは、グループ毎に最大値の行を求める問題のことです。

SQL select only rows with max value on a column
I have this table for documents (simplified version here):
id
rev
content
1
1
...
2
1
...
1
2
...
1
3
...
How do I select one row per id and only the greatest r...

