mySQL query across 2 databases
Posted on 2009-05-26
I have a query to compare tables in two separate databases - they share the same connection details except the database names are different. But now the databases need to be on different servers so they CAN'T share the same connection. At the moment this is how it is:
$sql="SELECT tab1.* FROM db1.products as tab1, db2.products as tab2 where tab1.products_last_modified != tab2.products_last_modified and tab1.products_id = tab2.products_id";
$result = @mysql_query($sql, $connection);
How can I modify this to compare the databases now they are on different servers/connections? If more queries are needed now, can you suggest them please?