Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

servidor sql selecione a primeira linha de um grupo

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

consulte http://msdn.microsoft.com/en-us/library/ms186734.aspx