I have a table having columns-
I want to query it to insert a column Position whereby records 1st, 2nd, 3rd, 4th etc will automatically inserted based on ScoresTotal. That is, 1st should be inserted in the Position column for the the row with the highest ScoresTotal. 2nd for the next, etc.
Maybe, this will help:
SELECT *,RANK() OVER(ORDER BY ScoresTotal DESC) AS Rnk FROM yourtable
answered Apr 02 '11 at 07:32 AM