Update a table joining 1 more table.
UPDATE t1 SET t1.col1 =1 FROM table1 t1 JOIN table2 t2
ON t1.ID=t2.ID
WHERE t1.Name='Test' AND t2.Age=25;
i get this error,You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FROM table1 t1 JOIN table2 t2 …
Any thoughts?
Thanks.
There shouldn’t be a
FROMclause in theUPDATEstatement, and theSETclause should follow the full set of table references:Test case:
Result: