how to update / insert data from a table belong to database "A" to the table, belong to database "B"?
for example, I have a table in the name ips, as shown below in database "A"
CREATE TABLE `ips` ( `id` int(10) unsigned NOT NULL DEFAULT '0', `begin_ip_num` int(11) unsigned DEFAULT NULL, `end_ip_num` int(11) unsigned DEFAULT NULL, `iso` varchar(3) DEFAULT NULL, `country` varchar(150) DEFAULT NULL ) ENGINE=InnoDB
Suppose I have a second table, the country belongs to database "B"
CREATE TABLE `country` ( `countryid` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `ordering` smallint(5) unsigned NOT NULL DEFAULT '0', `iso` char(2) NOT NULL, PRIMARY KEY (`countryid`) ) ENGINE=InnoDB
Note: two databases are on the same server.
source share