使用变量更新sqlite数据库

时间:2016-12-08 22:12:24

标签: python sqlite

我有以下代码来更新表中的值。当我运行代码时,我收到错误near "(": syntax error

这是我的代码:

cursor.execute('UPDATE playerList SET (gamesPlayed, totalPTS, totalREB, totalAST, totalSTL, totalTO, totalBLK, ftMade, ftAttempts, fgMade, fgAttempts, threeptMakes, threeptAttempts) = (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) WHERE playerCode = (?)', (newGp, newTotPts, newTotReb, newTotAst, newTotStl, newTotTo, newTotBlk, newFtMade, newFtAttempt, newFgMade, newFgAttempt, newThreePointMade, newThreePointAttempt, code))

我哪里错了?

1 个答案:

答案 0 :(得分:0)

仅在SQLite 3.15.0或更高版本中支持行值。如果您有早期版本(可能是任何当前的Python版本),则必须使用标准SQL语法documented in the documentation

相关问题