From: Ant Zucaro Date: Sun, 22 Jan 2012 03:54:41 +0000 (-0500) Subject: Small transaction to regenerate ranks. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5fd408f30c2f439b9d11ad11c5ea3f455260b18d;p=xonotic%2Fxonstatdb.git Small transaction to regenerate ranks. --- diff --git a/scripts/update_ranks.sql b/scripts/update_ranks.sql new file mode 100644 index 0000000..66e8b12 --- /dev/null +++ b/scripts/update_ranks.sql @@ -0,0 +1,10 @@ +begin; + delete from player_ranks; + + insert into player_ranks(player_id, nick, game_type_cd, elo, rank) + select p.player_id, p.nick, pe.game_type_cd, pe.elo, rank() + over (partition by pe.game_type_cd order by pe.elo desc) + from players p, player_elos pe + where p.player_id = pe.player_id; + +end;