select yt.id, yt.rev, yt.contents from YourTable yt where rev = (select max(rev) from YourTable st where yt.id=st.id)
Here is what the above code is Doing:
1. The subquery is finding the maximum revision number for each id.
2. The outer query is finding the rows that have the maximum revision number.
3. The outer query is returning the id, revision number, and contents.