select a,b
from (
select a,b,row_number() over(partition by a order by b desc) as roworder
from myTable
) temp
where roworder = 1
вижте http://msdn.microsoft.com/en-us/library/ms186734.aspx
select a,b
from (
select a,b,row_number() over(partition by a order by b desc) as roworder
from myTable
) temp
where roworder = 1
вижте http://msdn.microsoft.com/en-us/library/ms186734.aspx