3

I'm trying to execute this SQL query on an MS Access DB:

UPDATE WW_B
SET WW_B.WWtype_ID=1 
INNER JOIN New_data
  ON WW_B.StdNr = New_data.StdNr;

But I get the following error:

[Microsoft][ODBC Microsoft Access Driver]

Syntax error (missing operator) in expression 1 INNER JOIN New_data on WW_B.StdNr = New_data.StdNr.

I don't see where any operator is needed, since I don't use any parentheses or quotation marks.

I've also tried WWtype_ID='1' and WWtype_ID="1" and got the same error.

What am I doing wrong?

3 Answers 3

3

I was having the same problem and found this question while searching for an answer. Luckily I was able to find a solution while digging through some Access queries at work.

This is just another situation where MS Access does not play nice with standard SQL syntax.

The other answers are incorrect. You do not need a FROM clause, Access will just give you the same error message. Where you ran into the error was where you placed the JOIN. It seems intuitive that you would have FROM...JOIN... But this is MS Access where working with SQL is never intuitive.

In Access, UPDATE seems to take the place of FROM. Therefore, you add the JOIN statement to the end of the UPDATE clause.

UPDATE WW_B
INNER JOIN New_data
  ON WW_B.StdNr = New_data.StdNr
SET WW_B.WWtype_ID=1;

You can also add a WHERE clause after the SET statement if desired.

Sign up to request clarification or add additional context in comments.

Comments

-1

You need a FROM clause when using an INNER JOIN on an UPDATE:

UPDATE WW_B
SET WW_B.WWtype_ID = 1
FROM WW_B
INNER JOIN New_data
  on WW_B.StdNr = New_data.StdNr

Comments

-1

You are missing the FROM clause

UPDATE WW_B SET WW_B.WWtype_ID=1 FROM <your table> INNER JOIN New_data on WW_B.StdNr = New_data.StdNr

1 Comment

Thanks for your answers but I still get the same error "...in expression '1 FROM WW_B INNER JOIN New_data on WW_B.StdNr = New_data.StdNr'." Besides, why do I have to declare the table name using FROM if I already did that with UPDATE?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.