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它可以正常工作
答案 0 :(得分:1)
在SQL中,你说
DELETE FROM
不
DELETE * FROM
即使它是
SELECT * FROM
答案 1 :(得分:1)
DELETE FROM Books
WHERE ISBN IN (Select Class_Books.ISBN from Class_Books, Classes
WHERE Class_Books.Class_ID = Classes.Class_ID
AND Classes.Term_ID = 63
)
AND Year = '""'
答案 2 :(得分:1)
请尝试以下操作,这将删除具有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