I have 2 Mysql Db's, same structure, same name but in separate servers.
Client needs to update or insert data from one server to another
I did it like this
- Code: Select all Expand view
FWCONNECT oSvr HOST "localhost" USER "userx" PASSWORD "passx" DB "xDb"
FWCONNECT oRem HOST "otherhost" USER "userx" PASSWORD "passx" DB "xDb"
oDbSend:=oSvr:Rowset("select codigo,data1,data2 from table1 where condition")
nTotal:=oDbSend:RecCount()
If nTotal > 0
For x=1 to nTotal
oRem:Execute( "update table1 set data1=" + oDbSend:data1 + ", data2= + " + oDbSend:data2 + " where codigo='" + oDbSend:codigo + "'" )
oDbSend:Skip()
Next
Endif
oDbSend:End()
It works fine, BUT, is there any other way, like this in FWH/MARIADB
update oRem.table1 set table1.data1=oSvr.table1.data1 where condition
I saw a sample on a mysql forum, but I can't make it work
UPDATE database_a.clients A INNER JOIN database_b.clients B ON A.id = B.id SET B.email = A.email
Any help will be appreciated
From Chile. Adolfo