如何将数据从“ testing”数据库更新到“ testing2”都有相同的列。
答案 0 :(得分:0)
只需使用databasename.tablename.column将一个数据库更新为另一数据库表
示例
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
如果您想更新更多列,只需使用逗号将列名放在set clase中
答案 1 :(得分: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