I have a table:
id | id2 | last_attempt
1 | 100 | 201
2 | 100 | 202
3 | 101 | 203
4 | 102 | 204
5 | 100 | 205
6 | 102 | 206
7 | 101 | 207
I want to end up with only one instance of "id2" and it must be the one with the highest "id":
id | id2 | last_attempt
5 | 100 | 205
6 | 102 | 206
7 | 101 | 207
So I assume that I need to group by id2 and the do some kind of subquery to only include the latest items.
Any idea how to do this quickly?