DELETE
LIB, REL
FROM
test_library_song LIB
INNER JOIN
test_relation REL
ON
LIB.book_id = REL.book_id
WHERE
REL.user_id = '1'
AND
REL.book_id = '400'
LIMIT 1
它抛出一个错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 13
如果我删除 LIMIT 1,它会起作用,但我希望它处于安全状态。
最佳答案
在我看来,LIMIT
仅对单表删除有效
http://dev.mysql.com/doc/refman/5.0/en/delete.html
For the multiple-table syntax, DELETE deletes from each tbl_name the rows that satisfy the conditions. In this case, ORDER BY and LIMIT cannot be used.
关于mysql - 这个 MySQL 查询有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4786473/