MySQL 错误?语法错误在哪里?

发布于 2024-09-27 09:50:30 字数 440 浏览 1 评论 0原文

因此尝试使用“SELECT *”而不是“DELETE FROM”进行查询,效果非常好。

DELETE FROM  `80dage_garmin_track` t1 WHERE EXISTS (

SELECT 1 
FROM  `80dage_garmin_track` t2
WHERE t1.Length = t2.Length
AND t1.Time = t2.Time
AND t1.idgarmin_track > t2.idgarmin_track
)

MySQL 错误: .#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 1 行的 't1 WHERE EXISTS (SELECT 1 from 80dage_garmin_track` t2 WHERE t1.Le' 附近使用的正确语法)

Tried thus query with "SELECT *" instead of "DELETE FROM" and it worked perfectly.

DELETE FROM  `80dage_garmin_track` t1 WHERE EXISTS (

SELECT 1 
FROM  `80dage_garmin_track` t2
WHERE t1.Length = t2.Length
AND t1.Time = t2.Time
AND t1.idgarmin_track > t2.idgarmin_track
)

MySQL Error:
.#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 't1 WHERE EXISTS (SELECT 1 from 80dage_garmin_track` t2 WHERE t1.Le' at line 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人 2024-10-04 09:50:30

MySQL does not allow all kinds of sub selects in the WHERE clause of DELETE, see this thread. Yours may (or may not) be fine, if you drop the table alias (t1), which is also not allowed for DELETE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文