DELETE FROM Books INNER JOIN (Classes, Class_Books) ON (Books.ISBN = Class_Books.ISBN AND Class_Books.Class_ID = Classes.Class_ID AND Classes.Term_ID = 63) WHERE Year = '""'


提供错误:#1064-您的SQL语法有错误;

用SELECT代替DELETE可以正常工作

最佳答案

请尝试以下操作,这将删除具有Classes.Term_ID = 63的书籍中的记录。

DELETE b FROM Books b
    INNER JOIN Class_Books cb ON b.ISBN = cb.ISBN
    INNER JOIN Classes c ON cb.Class_ID = c.Class_ID
WHERE Year = '""'
  AND c.Term_ID = 63

关于mysql - 删除联接有问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3529210/

10-12 15:07