top n with ties


Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

declare @numbers table(nums integer);
insert into @numbers  values (10), (9), (8), (8), (2);

select nums
from ( 
  select nums,
         rank() over (order by nums desc) as rn
  from @numbers
) t
where rn <= 3;

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results