List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:July 8 1999 5:31am
Subject:RE: Problem with DELETE FROM LEFT JOIN WHERE syntax
View as plain text  
>>>>> "Jay" == Jay Miller <jaymiller@stripped> writes:

>> Here's the syntax I'm using, and the error message I get:
>> 
>> DELETE FROM
>> vsnetwork LEFT JOIN master
>> ON master.email=vsnetwork.email
>> WHERE master.email Is Null;
>> 
>> ERROR 1064: You have an error in your SQL
>> syntax near 'LEFT JOIN master ON master.email=vsnetwork.email
>> WHERE master.email Is Null;' at line 2
>> 
>> If I change the DELETE command to SELECT COUNT(*), or SELECT *,
>> it works great.

Jay> While it is a big pain, you cannot use multiple tables in a delete statement
Jay> in MySQL.  You have to select, then step through each record and issue a
Jay> delete.  I don't know if there are any plans to add this in the future.

Yes, it's on the TODO (after sub selects)

The question is of course should MySQL delete rows from vsnetwork AND
master in the above query?  (Probably only from vsnetwork;  In this
case the problem is which syntax to use if you want to delete from
both tables).

Regards,
Monty
Thread
Problem with DELETE FROM LEFT JOIN WHERE syntaxGarret W. Gengler7 Jul
  • RE: Problem with DELETE FROM LEFT JOIN WHERE syntaxJay Miller7 Jul
    • RE: Problem with DELETE FROM LEFT JOIN WHERE syntaxMichael Widenius8 Jul
  • Re: Problem with DELETE FROM LEFT JOIN WHERE syntaxBaruch Even8 Jul