diff options
author | emkael <emkael@tlen.pl> | 2017-10-02 23:48:02 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-10-02 23:48:02 +0200 |
commit | 19caef32a560a4a797fba4ab2fa93bc2b410039b (patch) | |
tree | 6b965e9e3320305517929d4792ec1948c51ec2a4 /jfr_playoff/sql.py | |
parent | 86654dee683d9a2cda00a528b006433cebeebf26 (diff) | |
parent | 40d09a61727d3c960a816def07fb319853a90116 (diff) |
Merge branch 'refactor'
Diffstat (limited to 'jfr_playoff/sql.py')
-rw-r--r-- | jfr_playoff/sql.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/jfr_playoff/sql.py b/jfr_playoff/sql.py new file mode 100644 index 0000000..b01bd08 --- /dev/null +++ b/jfr_playoff/sql.py @@ -0,0 +1,36 @@ +MATCH_RESULTS = ''' +SELECT t1.fullname, t2.fullname, matches.carry, + matches.vph, matches.vpv, matches.corrh, matches.corrv +FROM #db#.matches matches +JOIN #db#.teams t1 + ON t1.id = #db#.matches.homet +JOIN #db#.teams t2 + ON t2.id = #db#.matches.visit +WHERE matches.tabl = %s AND matches.rnd = %s +''' + +BOARD_COUNT = ''' +SELECT segmentsperround*boardspersegment, + SUM(sc1.contract IS NOT NULL AND sc2.contract IS NOT NULL) +FROM #db#.scores sc1 +JOIN #db#.scores sc2 + ON sc1.rnd = sc2.rnd + AND sc1.segment = sc2.segment + AND sc1.tabl = sc2.tabl + AND sc1.board = sc2.board + AND sc1.room = 1 + AND sc2.room = 2 +JOIN #db#.admin +WHERE sc1.tabl = %s AND sc1.rnd = %s +''' + +TOWEL_COUNT = ''' +SELECT #db#.admin.boardspersegment * SUM(#db#.segments.towel > 0) +FROM #db#.segments +JOIN #db#.admin +WHERE #db#.segments.tabl = %s AND #db#.segments.rnd = %s +''' + +PREFIX = ''' +SELECT shortname FROM #db#.admin +''' |