Langsung ke konten utama

Postingan

Menampilkan postingan dari April, 2019

SQL Server – Update From Table with INNER JOIN

Often we may need to update a column in a table based of another column in another table. In SQL Server you can do this using UPDATE statement by joining tables together. To understand this better let’s take a look at below contrived example. USE [SqlAndMe] GO SELECT CustomerID , Name , OrderAmount FROM    dbo . Customers GO SELECT OrderID , CustomerID , Amount FROM    dbo . Orders GO Result Set: CustomerID     Name           OrderAmount 3              Curtis         NULL 4              Lanna          NULL 5              Marlin         NULL 6       ...