0
votes

I am trying to type a SQL query in MS Access to update the records in FilesTable.FilePath with the records in Files.FPath, when the FilesTable.FileName Matches a record in Files.FName, but I receive an error:

UPDATE FilesTable
SET FilesTable.[FilePath] = Files.[FPath]
FROM (FilesTable INNER JOIN Files ON (FilesTable.[FileName] = Files.[FName])
WHERE *;

syntax error (missing operator) in query expression 'Files.[FPath] FROM (FilesTable INNER JOIN Files ON (FilesTable.[FileName] = Files.[FName]) WHERE *;'

I have also tried to add () after Set as well which results in an error as well:

UPDATE FilesTable
SET (FilesTable.[FilePath] = Files.[FPath])
FROM (FilesTable INNER JOIN Files ON (FilesTable.[FileName] = Files.[FName])
WHERE *;

Syntax Error in UPDATE Statement.

Here is how my tables looks like

1

1 Answers

0
votes

This is the correct query:

UPDATE FilesTable
INNER JOIN Files ON (FilesTable.FileName = Files.FName)
SET FilesTable.FilePath = Files.FPath