From e561163f93c9f7a3d2aea49543b5b9599e54ea51 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 6 Apr 2017 01:53:44 +0200 Subject: Documentation tips + example config for players histories --- docs/useful-sql.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 docs/useful-sql.md (limited to 'docs/useful-sql.md') diff --git a/docs/useful-sql.md b/docs/useful-sql.md new file mode 100644 index 0000000..32a8f5b --- /dev/null +++ b/docs/useful-sql.md @@ -0,0 +1,21 @@ +Update categories from current `players` table: + +``` +UPDATE rankings +JOIN players + ON players.id = rankings.pid +SET rankings.region = players.region, + rankings.flags = players.flags +WHERE rankings.date = '#DATE#'; +``` + +After importing ranking CSV to `temp_rankings`, copy to `rankings` with current categories: + +``` +INSERT INTO rankings ( + SELECT pid, `date`, place, score, region, flags \ + FROM temp_rankings + JOIN players + ON players.id = temp_rankings.pid +); +``` -- cgit v1.2.3