我正在尝试使用 MySQLdb 模块删除数据库中的记录。在https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-execute.html中,我发现multi=True
在执行中执行了多个查询,但它会产生错误。有人可以帮助我知道我缺少什么吗?
query = "DELETE FROM Service_Machine WHERE Id=(SELECT Id FROM Machines WHERE Id="+id+");" \
"DELETE FROM Machine_Usage WHERE Id=(SELECT Id FROM Machines WHERE Id="+id+");" \
"DELETE FROM Machines WHERE Id="+id+");
print(query)
self.cursor.execute(query, multi=True)