All I want to do is establish a Rank by Totals. I know there's a "Rank" function but RowNumber() does what I need (I think) and seems simpler: that is, it has fewer confusing disclaimers in the documentation. As it is, there are still a couple, so I thought I'd submit the query here and ask, is this apt to do something weird and counterintuitive? Because as written, it works fine -- it orders by Total Desc, and then assigns row numbers
SELECT [Name]
,[Total]
,ROW_NUMBER() over (order by Total desc) as "Rank"
FROM [theDB].[dbo].[theQuery]
order by Total desc;
This works, too...
SELECT [Name]
,[Total]
,ROW_NUMBER() over (order by Total desc) as "Rank"
FROM [theDB].[dbo].[theQuery]
...so I guess that means that "over(order by Total desc)" orders the result set, and then RowNumber() is applied. ?