1
2
3
4
5
6
7
8
|
#!/bin/bash
DBNAME=$1
PLAYERSDB=${LIGA_PLAYERS_DB_NAME}
ROUNDFROM=$2
ROUNDTO=$3
echo $DBNAME
QUERY="SELECT dmpplayers.id, dmpplayers.gname, dmpplayers.sname, dmpplayers.link, teams.fullname, segments.rnd, segments.segment FROM $DBNAME.butler butler JOIN $DBNAME.players dmpplayers ON dmpplayers.id = butler.id JOIN $PLAYERSDB.players players ON players.id = dmpplayers.link JOIN $DBNAME.teams teams ON teams.id = dmpplayers.team JOIN (SELECT rnd, segment, openN as pl FROM $DBNAME.segments UNION SELECT rnd, segment, openE as pl FROM $DBNAME.segments UNION SELECT rnd, segment, openW as pl FROM $DBNAME.segments UNION SELECT rnd, segment, openS as pl FROM $DBNAME.segments UNION SELECT rnd, segment, closeN as pl FROM $DBNAME.segments UNION SELECT rnd, segment, closeE as pl FROM $DBNAME.segments UNION SELECT rnd, segment, closeW as pl FROM $DBNAME.segments UNION SELECT rnd, segment, closeS as pl FROM $DBNAME.segments) segments ON segments.pl = dmpplayers.id WHERE players.flag2 <> 'T' AND segments.rnd >= $ROUNDFROM AND segments.rnd <= $ROUNDTO;"
echo $QUERY | mysql ${LIGA_MYSQL_CONNECTION_OPTS}
|