---
title: "How to UPDATE records using UPDATE statements with JOIN in SQL Server?"  
description: "How to UPDATE records using UPDATE statements with JOIN in SQL Server?"  
author: "Revati S Misra"  
published: 2023-07-11  
updated: 2023-07-12  
canonical: https://www.mindstick.com/forum/159026/how-to-update-records-using-update-statements-with-join-in-sql-server  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 2 minutes  

---

# How to UPDATE records using UPDATE statements with JOIN in SQL Server?

How to [UPDATE records](https://www.mindstick.com/forum/158986/how-to-update-records-using-entity-framework-core) using UPDATE statements with [JOIN in SQL](https://www.mindstick.com/forum/33686/what-is-a-self-join-in-sql-server) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)?

## Replies

### Reply by Aryan Kumar

**Updating [records](https://www.mindstick.com/forum/34640/how-to-create-a-stored-procedure-for-display-all-records) using [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) statements with [join](https://www.mindstick.com/articles/1487/join-sleep-and-interrupt-methods-in-c-sharp-threading) in [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server)**

You can update records using update statements with join in SQL Server by using the `UPDATE` statement with the `JOIN` clause. The `JOIN` clause allows you to join two tables together and update the records in one table based on the records in the other table.

The syntax for updating records using update statements with join in SQL Server is as follows:

SQL

```plaintext
UPDATE table_name
SET column1 = value1,
    column2 = value2,
    ...
FROM table1
JOIN table2
ON table1.column1 = table2.column1;
```

The `table_name` is the name of the table that you want to update. The `column1`, `column2`, etc. are the columns that you want to update. The `value1`, `value2`, etc. are the new values for the columns. The `table1` and `table2` are the names of the tables that you want to join. The `column1` and `column2` are the columns that you want to join on.

For example, the following code will update the `CustomerName` column in the `Customers` table to `John Smith` for all customers where the `CustomerID` is 100:

SQL

```plaintext
UPDATE Customers
SET CustomerName = 'John Smith'
FROM Customers
JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
WHERE Customers.CustomerID = 100;
```

This code will first join the `Customers` and `Orders` tables on the `CustomerID` column. Then, it will update the `CustomerName` column in the `Customers` table to `John Smith` for all rows where the `CustomerID` is 100.


---

Original Source: https://www.mindstick.com/forum/159026/how-to-update-records-using-update-statements-with-join-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
