-1

How to Update data from database "testing" to "testing2" both have the same column.

Sample Image

2 Answers2

0

just use databasename.tablename.column for updating one database to different database table

example

    update testing.tbl_customer 
inner join testing2.tbl_customer
on testing.tbl_customer.CustomerID=testing2.tbl_customer.CustomerID

set testing.tbl_customer.CustomerName=testing2.tbl_customer.CustomerName

if you want to update more column just use coma and put column name in set cluase

Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63
  • I don't understand `RA.Sales` `tblAccounts` `tblSalesRepsAccountLink` `AccountCode` where did you get that? –  Jun 22 '18 at 10:11
  • @Noob that is alis of 2nd dabatabase and its table name, can you please share your database name and table name so that i can make example by using yours – Zaynul Abadin Tuhin Jun 22 '18 at 10:26
  • just click sample image –  Jun 22 '18 at 10:28
0
UPDATE testing2.tbl_customer c1
INNER JOIN testing.tbl_customer c2 ON c1.CustomerID = c2.CustomerID 
SET c1.CustomerName = c2.CustomerName,
    c1.Address = c2.Address, 
    c1.City = c2.City, 
    c1.PostalCode = c2.PostalCode, 
    c1.Country = c2.Country