summaryrefslogtreecommitdiff
path: root/queries/player.sql
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-27 18:40:33 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-27 18:40:33 +0100
commit6ac4d07004c94cf73134580e7d104e514b17bf82 (patch)
tree7b21bce58b1a63beaad0e1e4aeb3f1f0e84ce21b /queries/player.sql
downloadcompiler-6ac4d07004c94cf73134580e7d104e514b17bf82.tar.gz
compiler-6ac4d07004c94cf73134580e7d104e514b17bf82.zip
allow writing web-web queries
Diffstat (limited to 'queries/player.sql')
-rw-r--r--queries/player.sql9
1 files changed, 9 insertions, 0 deletions
diff --git a/queries/player.sql b/queries/player.sql
new file mode 100644
index 0000000..e847de2
--- /dev/null
+++ b/queries/player.sql
@@ -0,0 +1,9 @@
+-- count the number of matches we have from that player in the database
+-- UPDATE player SET "games_in_db"=
+SELECT
+COUNT(DISTINCT match."apiId") AS "games_in_db"
+FROM player
+JOIN participant ON player."apiId" = participant."player_apiId"
+JOIN roster ON participant."roster_apiId" = roster."apiId"
+JOIN match ON roster."match_apiId" = match."apiId"
+WHERE player.id=$1