MYSQL语法不正确[重复]
Posted
技术标签:
【中文标题】MYSQL语法不正确[重复]【英文标题】:MYSQL Syntax incorrect [duplicate] 【发布时间】:2016-01-26 10:40:50 【问题描述】:我在下面的语句中得到了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 'c
JOIN campaignsFroms f ON f.id = c.id
JOIN campaignsRaw r ON r.' at line 2
的错误
我缺少什么语法?
代码:
DELETE
FROM campaigns c
JOIN campaignsFroms f ON f.id = c.id
JOIN campaignsRaw r ON r.id = c.id
JOIN campaignsSubjects s ON s.id = c.id
JOIN campaignIPTracking ip ON ip.id = c.id
JOIN campaignTracking ct ON ct.id = c.id
WHERE c.id = '1582'
【问题讨论】:
你试过重新输入c JOIN campaignsFroms f ON f.id = c.id JOIN campaignsRaw r ON r.
吗?
***.com/questions/652770/delete-with-join-in-mysql
另一个问题的摘录:a)您不能对主表使用别名(因此必须删除别名c
)。 b) 您必须在多表删除中指定要从哪个表中删除,因此该语句应以DELETE campaigns FROM campaigns
开头。
【参考方案1】:
DELETE c
FROM campaigns c
JOIN campaignsFroms f ON f.id = c.id
JOIN campaignsRaw r ON r.id = c.id
JOIN campaignsSubjects s ON s.id = c.id
JOIN campaignIPTracking ip ON ip.id = c.id
JOIN campaignTracking ct ON ct.id = c.id
WHERE c.id = '1582'
【讨论】:
你可以使用连接删除吗?? 为什么要投反对票?使用 JOIN 删除的语法是正确的。以上是关于MYSQL语法不正确[重复]的主要内容,如果未能解决你的问题,请参考以下文章
“您的 SQL 语法有错误;请检查与您的 MySQL 服务器版本相对应的手册以获取正确的语法错误”Hibernate 4 [重复]
MySQL #1064 - 您的 SQL 语法 2020 有错误 [重复]