我正在尝试从具有相同条件的多个表中删除多行但总是会返回语法错误。
这是代码:
DELETE FROM table1,table2,table3
WHERE guid = 'CE4EF453-937F-C7F9-7AE429VB0128'
错误代码是:
1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以获得正确的语法
在第2行'WHERE guid ='CE4EF453-937F-C7F9-7AE429VB0128'附近
答案 0 :(得分:1)
您缺少INNER JOIN。或许像以下那样。
DELETE FROM table1,table2,table3
USING table1 INNER JOIN table2 INNER JOIN table3
WHERE table1.guid = 'CE4EF453-937F-C7F9-7AE429VB0128'
AND table2.guid = table1.guid
AND table3.guid = table1.guid
<强> (Reference) 强>
答案 1 :(得分:0)
给这个人一个机会:
DELETE FROM table1,table2,table3
WHERE table1.guid = 'CE4EF453-937F-C7F9-7AE429VB0128'
AND table1.guid = table2.guid
AND table1.guid = table3.guid