You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cursor.execute("SELECT TeamID,MAX(CountedTeam) FROM (SELECT TeamMap.TeamID TeamID,count(TeamMap.TeamID) CountedTeam FROM (SELECT PlayerMap.GameMapID PlayerMapGameID,PlayerID FROM PlayerMap,GameMap,Game WHERE PlayerID = ? AND PlayerMap.GameMapID = GameMap.GameMapID AND GameMap.GameID = Game.GameID AND Game.Date > ?),TeamMap WHERE TeamMap.GameMapID = PlayerMapGameID GROUP BY TeamMap.TeamID)",(playerID,date))
#Above counts each team a player has played for and for how many times.
teamID = cursor.fetchall()[0][0]
if teamID == None:
teamID=0
cursor.execute("UPDATE Player SET TeamID = (?) WHERE PlayerID = (?)",(teamID,playerID))