First, thanks for looking. I don't post a lot of questions as I can usually find an answer but this one is making me wonder if I am doing something wrong.
SQL Server 2008 (although this server will be upgraded to 2016 soon).
Don't know if this can even be done, so that's why I am asking. I am trying to rank orders and assign points to the person with the most orders. Highest person gets 10 pts, next is 9 pts, etc. etc.
Here is what I have
Salesperson Orders TotalSales
---------------------------------------
5695 270 23500
8475 310 46000
1287 105 9000
5412 475 75600
What I would like to see is this
Salesperson Orders TotalSales Ranking
---------------------------------------------------
5412 475 75600 10
8475 310 46000 9
5695 270 23500 8
1287 105 9000 7
and so on and so on...
I'm trying the following, but its all I know about RANK
SELECT
Salesperson,
RANK() OVER (PARTITION BY Orders ORDER BY ORDERS DESC),
TotalSales
FROM
OrdersTable
Any help is greatly appreciated!!