Return to Snippet

Revision: 70444
at February 16, 2016 14:08 by ManuelToledo


Initial Code
USE [AdventureWorks2016CTP3]

SELECT
	[Sales].[SalesOrderHeader].[CustomerID],
	count([SalesOrderID]) AS OrdersCount,
	DENSE_RANK() OVER (ORDER BY count([SalesOrderID]) DESC) AS Rank
	
FROM
	[Sales].[SalesOrderHeader]

GROUP BY 
	[Sales].[SalesOrderHeader].[CustomerID]

Initial URL

                                

Initial Description
SQL Server query sample using rank/dense_rank

Initial Title
SQL Server query sample using rank/dense_rank

Initial Tags
sql, server

Initial Language
SQL