Home > database >  Syntax Error SQL UPDATE in MS Access with JOIN on same table
Syntax Error SQL UPDATE in MS Access with JOIN on same table

Time:08-01

I'm getting a syntax error within MS Access VBA whereas the same line perfectly works fine in SQL Server:

UPDATE a 
SET a.Result = b.Result, a.Part = b.Part 
FROM tbl_Parts a 
JOIN ( SELECT b.* FROM tbl_Parts b WHERE b.ID = 180) b 
ON b.Part_Nr = a.Part_Nr;

I'm trying to use one row as a template and copy it's content to already existing other rows from the same Part-ID.

CodePudding user response:

Consider:

UPDATE tbl_Parts AS a 
INNER JOIN (SELECT * FROM tbl_Parts WHERE ID = 180) AS b
ON b.Part_Nr = a.Part_Nr
SET a.Result = b.Result, a.Part = b.Part;
  • Related