From 5fd408f30c2f439b9d11ad11c5ea3f455260b18d Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 21 Jan 2012 22:54:41 -0500 Subject: [PATCH] Small transaction to regenerate ranks. --- scripts/update_ranks.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/update_ranks.sql 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; -- 2.39.2