Jak używać RANK () w SQL Server

Mam problem z używaniemRANK() w SQL Server.

Oto mój kod:

SELECT contendernum,
       totals, 
       RANK() OVER (PARTITION BY ContenderNum ORDER BY totals ASC) AS xRank
FROM (
   SELECT ContenderNum,
          SUM(Criteria1+Criteria2+Criteria3+Criteria4) AS totals
   FROM Cat1GroupImpersonation
   GROUP BY ContenderNum
) AS a

Wyniki tego zapytania są następujące:

contendernum    totals    xRank
          1       196        1
          2       181        1
          3       192        1
          4       181        1
          5       179        1

Jaki jest mój pożądany rezultat:

contendernum    totals    xRank
          1       196        1
          2       181        3
          3       192        2
          4       181        3
          5       179        4

Chcę ocenić wynik na podstawietotals. Jeśli są takie same wartości jak181, wtedy dwie liczby będą takie samexRank.

questionAnswers(8)

yourAnswerToTheQuestion