I have the following table structure for a table Player
Table Player {
Long playerID;
Long points;
Long rank;
}
Assuming that th
EDIT: The update statement presented earlier did not work.
Although this is not exactly what you are asking for: You can generate the rank on the fly when selecting:
select p1.playerID, p1.points, (1 + (
select count(playerID)
from Player p2
where p2.points > p1.points
)) as rank
from Player p1
order by points desc
EDIT: Trying the UPDATE statement once more. How about a temporary table:
create temporary table PlayerRank
as select p1.playerID, (1 + (select count(playerID)
from Player p2
where p2.points > p1.points
)) as rank
from Player p1;
update Player p set rank = (select rank from PlayerRank r
where r.playerID = p.playerID);
drop table PlayerRank;
Hope this helps.