summaryrefslogtreecommitdiff
path: root/docs/useful-sql.md
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-04-06 01:53:44 +0200
committeremkael <emkael@tlen.pl>2017-04-06 01:53:44 +0200
commite561163f93c9f7a3d2aea49543b5b9599e54ea51 (patch)
treea78c5c6834c6e90d43665480df21ff338276d4ba /docs/useful-sql.md
parente106531c0d74dccb20794ab9226bbde52fc4129e (diff)
Documentation tips + example config for players histories
Diffstat (limited to 'docs/useful-sql.md')
-rw-r--r--docs/useful-sql.md21
1 files changed, 21 insertions, 0 deletions
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
+);
+```