Query to populate top users
I'm having a problem with a query and was wondering of anyone knows the trick to this ad-hoc query.
Basically I am trying to find the top 10 users of my site, but the part i want to do is to have SQL return me back a "Rank" field that will by itself, increment itself.
Like for instance in a query, you can do something such as
"Select 1 AS Rank, AccountID FROM Score" and this will return two fields, one for accountID's and one field named Rank which equals 1.
Well what i want is to somehow:
Select TOP 10 Rank as Rank+1, AccountID FROM Score ORDER BY Score DESC"
I know that the "Rank as Rank+1" isn't correct syntax, that's the part i'm trying to find which will increment itself from 1 to 10 for each record somehow. any thoughts?