This code create's rank on the fly and set's them accordingly..
Now the question is how do I update the Rank values in the table, without duplicating?

Help me Please!
Thanks ...

```
SELECT TeamID,
       TeamName,
       TeamLeader,
       TeamEmail,
       TeamWins,
       TeamLoss,
       TeamPoints,
       TeamRank
       FROM
          (
             SELECT TeamID,
                    TeamName,
                    TeamLeader,
                    TeamEmail,
                    TeamWins,
                    TeamLoss,
                    TeamPoints,
                    @Rank := @Rank + 1 AS TeamRank
                    FROM team
                    CROSS JOIN (SELECT @Rank:=0) Sub0
                    ORDER BY TeamPoints DESC
          ) Sub1

```

**UPDATE [PROBLEM SOLVED]**

I got the problem solved, below is the solution with reference to the user who solved it

You are just doing a SELECT statement. In order to UPDATE it really you have to use an UPDATE statement on the original table and use that query to feed values of teamRank:

```
UPDATE team t
INNER JOIN(
       SELECT TeamID,
       TeamPoints,
       @Rank := @Rank + 1 AS TeamRank
       FROM team
       CROSS JOIN (SELECT @Rank:=0) Sub0
       ORDER BY TeamPoints DESC
       ) a ON a.teamID = t.teamID
       SET t.teamRank = a.teamRank

```

User: <https://stackoverflow.com/users/1385896/filipe-silva> "

Thanks to Filipe Silva ..