Good morning, everyone!
I have a sql statement
SELECT TOP 20 WITH TIES ssn, LName, FInitial, SUM(hrsWorked) AS [Total HrsWorked], SUM(amtEarned) AS [Total AmtEarned]
FROM MyDetailedTable
GROUP BY ssn, LName, FInitial
Order by SUM(hrsWorked) desc, SUM(amtEarned) desc
I need to have a field called Rank to be inserted into this select statement which will have the number running from 1 to 20 each time the statement is executed.
How can I implement this?
Thanks in advance
I have a sql statement
SELECT TOP 20 WITH TIES ssn, LName, FInitial, SUM(hrsWorked) AS [Total HrsWorked], SUM(amtEarned) AS [Total AmtEarned]
FROM MyDetailedTable
GROUP BY ssn, LName, FInitial
Order by SUM(hrsWorked) desc, SUM(amtEarned) desc
I need to have a field called Rank to be inserted into this select statement which will have the number running from 1 to 20 each time the statement is executed.
How can I implement this?
Thanks in advance