Quantcast
Channel: Recent Edits
Viewing all articles
Browse latest Browse all 12198

A variation of the RANK() example

$
0
0
-- Using RANK() : this will get you the first 10 employees with the highest salary rates.-- I rather use dense_rank to top 10 salary rates. Since there can be employees with the same salary rate, you can potentially get more than 10 rows, so I think dense_rank accomplishes this better. select drv.BusinessEntityID, drv.Rate, drv.RankBySalary from (SELECT BusinessEntityID, Rate , RANK() OVER (ORDER BY Rate DESC) AS RankBySalary --dense_RANK() OVER (ORDER BY Rate DESC) AS RankBySa

Viewing all articles
Browse latest Browse all 12198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>