cur.execute("""SELECT match_own_goals.game_id, home_team, away_team, team, time
FROM football.match_own_goals
JOIN football.match_info
ON match_own_goals.game_id = match_info.game_id""")
e = cur.fetchall()
for game in e:
print game
time = game[4]
print type(time)
if game[3] == 1:
team_id = game[1]
else:
team_id = game[2]
cur.execute("""UPDATE football.match_own_goals
SET team_id = %s
WHERE time = %s AND game_id = %s""", (team_id, time, game[0]))
db.commit()
这已经更新了大约 10% 的行,不知道为什么。时间实际上是一个浮点数(它不代表时间,更多的是足球比赛中的一个时间点,例如 87 分钟、54 分钟)。
时间绝对是问题,因为当我删除它时它工作正常,但我真的需要它在那里用于其他表。
我究竟做错了什么?谢谢