Coding⏱️ 2 min read📅 2026-06-03

How to Fix: Update a table using JOIN in SQL Server?

SQL Server JOIN syntax error fix.

Quick Answer: The issue is that the table alias 'a' should be used before the JOIN keyword, not after. Change the line to `UPDATE table1 INNER JOIN table2 b ON table1.commonfield = b.[common field]`.

The error you're encountering is due to the incorrect syntax used in the UPDATE statement. The issue lies in the fact that you are using the alias 'a' and 'b' which are not valid keywords in SQL Server. Instead, you should use table names or aliases to reference tables.

✅ Best Solutions to Fix It

Method 1: Using Table Names

  1. Step 1: Replace 'a' and 'b' with the actual table names, e.g. `UPDATE table1 INNER JOIN table2 ON table1.commonfield = table2.[common field] SET table1.CalculatedColumn= table2.[Calculated Column] WHERE ...`

Method 2: Using Aliases

  1. Step 1: Define an alias for the table, e.g. `UPDATE t1 INNER JOIN t2 ON t1.commonfield = t2.[common field] SET t1.CalculatedColumn= t2.[Calculated Column] WHERE ...`

🎯 Final Words

By using either table names or aliases, you should be able to fix the error and successfully update your tables.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions