删除多行错误

时间:2015-05-24 15:31:55

标签: mysql pdo mysqli

我有一个删除某些行的查询,它有什么问题吗?

DELETE FROM table1, table2, table3
WHERE table1.id = table2.id
AND table2.id = table3.id
AND table1.id = 10

请帮助查询

1 个答案:

答案 0 :(得分:0)

使用此查询它应该可以工作。

DELETE t1, t2, t3 FROM table1 t1
INNER JOIN table2 t2 ON t1.id = t2.id
INNER JOIN table3 t3 ON t2.id = t3.id
WHERE t1.id = 10

我使用此架构在本地测试了它:http://sqlfiddle.com/#!9/e5be4/9

您可以在socd中找到详细信息:https://dev.mysql.com/doc/refman/5.0/en/delete.html