MySQL 错误?语法错误在哪里?
因此尝试使用“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MySQL不允许在DELETE的WHERE子句中进行各种子选择,请参见此线程。如果您删除表别名(t1),您的可能(或可能不会)没问题,这也是 DELETE 不允许的。
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.