这个MySQL查询有什么问题?

问题描述:

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 

它抛出一个错误:这个MySQL查询有什么问题?

#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 

如果我删除限制1,它的工作原理,但我想它的保安措施。

+0

你指的是什么安全措施? – BoltClock 2011-01-24 19:57:05

当我看到它时,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.

+0

谢谢。猜猜我可以自己想出一个。 – 2011-01-24 20:11:36

限制不能在多表中删除使用。请参阅DELETE语法文档。