Horje
update table from another table Code Example
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;
sql update from select
UPDATE YourTable 
SET Col1 = OtherTable.Col1, 
    Col2 = OtherTable.Col2 
FROM (
    SELECT ID, Col1, Col2 
    FROM other_table) AS OtherTable
WHERE 
    OtherTable.ID = YourTable.ID
update table from another table
UPDATE accounts SET (contact_first_name, contact_last_name) =
    (SELECT first_name, last_name FROM salesmen
     WHERE salesmen.id = accounts.sales_id);




Sql

Related
low level operator in dbms Code Example low level operator in dbms Code Example
create dabase psql Code Example create dabase psql Code Example
Pattern Sql Rlike same as REGEXP Code Example Pattern Sql Rlike same as REGEXP Code Example
Create Stored Procedure Code Example Create Stored Procedure Code Example
dump sql file to database postgres Code Example dump sql file to database postgres Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7