我正在使用 Python MySQL 连接器通过更新行将数据添加到表中。用户输入序列号,然后添加序列号所在的行。我不断收到 SQL 语法错误,但我不知道它是什么。 query = ("UPDATE `items` SET salesInfo = %s, shippingDate = %s, warrantyExpiration = %s, item = %s, WHERE serialNum = %s") cursor.execute(query, (info, shipDate, warranty, name, sn, )) conn.commit()错误:mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE serialNum = '1B0000021A974726'' at line 1“1B0000021A974726”是用户输入的序列号,表中已经存在。
添加回答
举报
0/150
提交
取消