Answers for "update set from where sql from another table"

SQL
2

sql update from different table

-- SQL Server
UPDATE Sales_Import
SET Sales_Import.AccountNumber = RAN.AccountNumber
FROM Sales_Import SI
INNER JOIN RetrieveAccountNumber RAN
ON SI.LeadID = RAN.LeadID;
-- MySQL & MariaDB
UPDATE Sales_Import SI, RetrieveAccountNumber RAN
SET SI.AccountNumber = RAN.AccountNumber
WHERE SI.LeadID = RAN.LeadID;
Posted by: Guest on May-13-2020
5

inner join update

UPDATE 
    t1
SET 
    t1.c1 = t2.c2,
    t1.c2 = expression,
    ...   
FROM 
    t1
    [INNER | LEFT] JOIN t2 ON join_predicate
WHERE 
    where_predicate;
Posted by: Guest on September-11-2020

Code answers related to "update set from where sql from another table"

Code answers related to "SQL"

Browse Popular Code Answers by Language