ID|  tag  |  version
-----+-----+-----
1|  A  |  10
2|  A  |  20
3|  B  |  99
3|  C  |  30
3|  F  |  40
desired output:
1 A 10
2 A 20
3 B 99
How can I get the max version of every ID and the corresponding tag for that version? Speed is important (I have around 28m rows) so a nested Select won't do it. Also a simple Group by ID with a max(version) doesn't work because I also need the corresponding Tag where the version is max.
 
     
    