Skip to content

Instantly share code, notes, and snippets.

@shammelburg
Created April 28, 2016 13:18
Show Gist options
  • Save shammelburg/e7f80984d147ec6e6cdb8c3830ed80f3 to your computer and use it in GitHub Desktop.
Save shammelburg/e7f80984d147ec6e6cdb8c3830ed80f3 to your computer and use it in GitHub Desktop.
select ListPrice
, Name
, row_number() over (order by ListPrice desc) as 'row_number'
, rank() over (order by ListPrice desc) as 'rank'
, dense_rank() over (order by ListPrice desc) as 'dense_rank'
, ntile(5) over (order by ListPrice desc) as 'ntile'
from Production.Product
where ProductSubcategoryID = 1
order by ListPrice desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment