List:General Discussion« Previous MessageNext Message »
From:Brandon Shuey Date:March 18 1999 10:46pm
Subject:SQL Question??: Using Join in Update
View as plain text  
I am running mySQL under NT4.0.
I am trying a simple update statement that does a left join and updates on null values. 
The exact same join works in a select
statement but will not work in a update statement.  I get the following error:
ERROR 1064 at line1: parse error near 'LEFT JOIN table2 ON table1.ID=table2.Field'

This is the select statement that works correctly:
SELECT table1.* FROM table1
LEFT JOIN table2 ON(table1.ID = table2.Field)
WHERE (((table2.Field) is NULL))

Here is the update that doesn't work:
UPDATE table1
LEFT JOIN table2 ON table1.ID = table2.Field
SET table1.ID = "Invalid"
WHERE (((table2.Field) Is Null));

The documentation does not address joins in Update queries so I do believe this is a valid
question.
Brandon Shuey
WebCentric Inc.
(316) 612-8030
brandon@stripped



Thread
SQL Question??: Using Join in Update(Brandon Shuey)18 Mar
  • SQL Question??: Using Join in Updatesinisa19 Mar
  • SQL Question??: Using Join in UpdateMichael Widenius19 Mar