RANK

Syntax:

SELECT <columns>, 
    RANK() OVER (PARTITION BY <column_name_as_partition_definition> ORDER BY <column_name>) (optional: alias - AS <column_alias>) 
FROM <table> 
(optional: ORDER BY <column_names>)

Example1: Top 10 Transactions

SELECT TOP(10)
RANK() OVER (ORDER BY TransactionAmount DESC) AS TARank,
*
FROM Sales.CustomerTransactions ct

Example2: Top 3 Transactions Per Customer

;WITH BASE
    AS (SELECT RANK() OVER(PARTITION BY ct.CustomerID
               ORDER BY TransactionAmount DESC) AS TARank,
               *
        FROM Sales.CustomerTransactions ct)
    SELECT *
    FROM BASE b
    WHERE b.TARank < 4
    ORDER BY b.CustomerID,
             b.TARank;