grj*_*jj3 4 sql ms-access jet sql-delete
我有以下查询,适用于MySQL:
DELETE `test1`, `test2`, `test3`, `test4` FROM
`test1` LEFT JOIN `test2` ON test2.qid = test1.id
LEFT JOIN test3 ON test3.tid = test2.id
LEFT JOIN test4.qid = test1.id
WHERE test1.id = {0}
Run Code Online (Sandbox Code Playgroud)
但它不适用于MS Access.我试图在LEFT JOIN它周围添加括号,但它在FROM子句中给出了语法错误.那么这个查询应该怎样才能在MS Access中工作?
Oli*_*bes 12
Access DELETE需要一个星号(*): DELETE * FROM ...
此外,必须使用括号嵌套连接:
DELETE test1.*, test2.*, test3.*, test4.*
FROM
(
(
test1
LEFT JOIN test2 ON test1.qid = test2.id
)
LEFT JOIN test3 ON test2.tid = test3.id
)
LEFT JOIN test4 ON test1.qid = test4.id
WHERE test1.id = {0}
Run Code Online (Sandbox Code Playgroud)