SQL DELETE在PHPmyAdmin中崩溃

时间:2009-10-03 21:46:52

标签: mysql sql phpmyadmin left-join sql-delete

SQL DELAd在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 - 你的SQL语法中有错误;)但是完全可以使用SELECT而不是删除,为什么会这样?

2 个答案:

答案 0 :(得分:0)

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

例如来自用户:

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

答案 1 :(得分:0)

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