sql server - MSSQL Selecting top 10 but include columns with duplicate values -
hi i'm trying top ten winners of competition using score. problem when there 2 users same score example i'm getting top 9 in effect (should eleven records returned if there 2 top 3 scores , rest unique example)...
i'm not sure how tackle , appreciate guidance.
thanks in advance,
ian
should eleven records returned if there 2 top 3 scores
sounds want use dense_rank
.
this give rows in top 10 scores.
select t.score ( select score, dense_rank() over(order score) rn yourtable ) t t.rn <= 10
Comments
Post a Comment