How can I get row's index from a table in SQL Server?
You can use ROW.NUMBER
This is a example syntax for MySQL
SELECT t1.toplistId,
@RankRow := @RankRow+ 1 AS Rank
FROM toplist t1
JOIN (SELECT @RankRow := 0) r;
This is a example syntax for MsSQL
SELECT ROW_NUMBER() OVER(ORDER BY YourColumn) AS Rank,TopListId
FROM TopList
ROW_NUMBER() MS SQL
Use in your code analytic functions