Update a table using JOIN in SQL Server?

Update a table using JOIN in SQL Server?

Hello everyone, I am going to share the query to update a table using JOIN and without in SQL Server.

            Table of Contents.
1.       Query for update a table using INNER JOIN.
2.       Query for update a table without JOIN.

The query detail as given below.

Query for update a table using INNER JOIN. i.e.

UPDATE UR SET UR.IsDeleted = 1
     FROM [DBO].[USERROLE] AS UR
     INNER JOIN [DBO].[USERS] AS U  ON UR.UserID = U.UserID
WHERE UR.UserID = 1001
        AND  U.UserID = 1001

Query for update a table without JOIN. i.e.

UPDATE U 
SET U.ISDELETED=0
FROM [DBO].[USERROLE] AS U
WHERE U.USERID=1023

For more detail go to link.



ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.