SQL DELETE 在 PHPmyAdmin 中失败

发布于 2024-08-06 19:38:13 字数 374 浏览 8 评论 0原文

SQL DELETE 在 PHPmyAdmin 中失败。无法弄清楚为什么;是因为 LEFT OUTER JOIN 吗?

SELECT * 
  FROM `User` 
LEFT OUTER JOIN `freshersdata` ON `User`.`username`=`freshersdata`.`username` 
 WHERE (`freshersdata`.`username` IS null) 
   AND (`User`.`Persistent`!=1)

此 SQL 查询失败并显示 (#1064 - You had an error in your SQL syntax;) 消息,但使用 SELECT 而不是删除可以完美工作,这是为什么?

SQL DELETE falling over in PHPmyAdmin. Can't work out why; is it because of LEFT OUTER JOIN?

SELECT * 
  FROM `User` 
LEFT OUTER JOIN `freshersdata` ON `User`.`username`=`freshersdata`.`username` 
 WHERE (`freshersdata`.`username` IS null) 
   AND (`User`.`Persistent`!=1)

This SQL query is falling over with ( #1064 - You have an error in your SQL syntax; ) message but works perfecly with a SELECT instead of a delete, why is this?

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

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

发布评论

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

评论(2

心是晴朗的。 2024-08-13 19:38:13

您必须指定要从哪个表中删除:

例如从用户中:

DELETE User.* 
  FROM User 
LEFT OUTER JOIN freshersdata ON User.username=freshersdata.username 
 WHERE (freshersdata.username IS null) AND (User.Persistent!=1)

You have to specify from which table you want to delete:

For example from User:

DELETE User.* 
  FROM User 
LEFT OUTER JOIN freshersdata ON User.username=freshersdata.username 
 WHERE (freshersdata.username IS null) AND (User.Persistent!=1)
携余温的黄昏 2024-08-13 19:38:13
DELETE FROM User 
LEFT OUTER JOIN 
   freshersdata ON User.username=freshersdata.username  
WHERE (freshersdata.username IS null) AND (User.Persistent!=1)
DELETE FROM User 
LEFT OUTER JOIN 
   freshersdata ON User.username=freshersdata.username  
WHERE (freshersdata.username IS null) AND (User.Persistent!=1)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文