update from table code example
Example 1: sql update from another table
UPDATE table1
SET table1.Price = table2.price
FROM table1 INNER JOIN table2 ON table1.ID = table2.id
Example 2: sql update from different table
UPDATE
Sales_Import
SET
Sales_Import.AccountNumber = RAN.AccountNumber
FROM
Sales_Import SI
INNER JOIN
RetrieveAccountNumber RAN
ON
SI.LeadID = RAN.LeadID;
UPDATE
Sales_Import SI,
RetrieveAccountNumber RAN
SET
SI.AccountNumber = RAN.AccountNumber
WHERE
SI.LeadID = RAN.LeadID;
Example 3: update a columd sql
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example 4: how to update data in sql
UPDATING ROW
Update TableName set ColumnName = value where condition;
update scrumteam set firstname =‘Martin' where EmployeeID='1';
update scrumteam set lastname =‘Murtin' where firstname='Tom’;