Thursday, 2 June 2011

RANK( ) and DENSE_RANK( ) example

SELECT Country, 
		DENSE_RANK() OVER (ORDER BY Country) AS [Dense_Rank result],
		RANK() OVER (ORDER BY Country) AS [Rank result]
FROM Customers
DENSE_RANK - value is based on the item's uniqueness, same items have same values
RANK - value is based on the starting row number for the new item, same items have same values




No comments: