views:

78

answers:

2
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?

A: 

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)
najmeddine
worked many thanks
Gwilym
A: 
DELETE FROM User 
LEFT OUTER JOIN 
   freshersdata ON User.username=freshersdata.username  
WHERE (freshersdata.username IS null) AND (User.Persistent!=1)
Davy