How to Update data from database "testing" to "testing2" both have the same column.
Asked
Active
Viewed 54 times
-1
-
Does this help you out? https://stackoverflow.com/questions/3502269/how-to-insert-table-values-from-one-database-to-another-database – JeroenE Jun 22 '18 at 09:46
-
What have you tried so far? That should be well documented – Nico Haase Jun 22 '18 at 09:49
-
@NicoHaase that's only for `testing` but `testing2` don't have the data like `testing`. – Jun 22 '18 at 10:06
-
Still, what have you tried? – Nico Haase Jun 22 '18 at 11:32
2 Answers
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
-
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

Hitesh Makvana
- 44
- 4