mysql - 这个 MySQL 查询有什么问题?

标签 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

它抛出一个错误:

#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/

相关文章:

php - 在 html : returned data object empty 中显示来自 SQL 数据库的数据

mysql - 你能在 JSON 数据中做一个查询,比如 mysql 查询吗

mysql - 如何在SQL中执行动态if语句?

PHP PDO 唯一随机数生成器

java - Hibernate:按日期和时间排序数据

php - 更新字符串以遵循特定格式

Java:Windows 中无法识别 File.separator?

mysql - 热门报告指标 MYSQL

mysql - 合并两个表,排除相同的记录

mysql - 有什么方法可以在 myisam 中使用 where 条件进行快速不准确的计数(*)?