Fog Juice Posted June 6, 2010 Share Posted June 6, 2010 Hello, I want to make one mysql query but it will be connecting to two different databases on two different servers. Is this possible? Here is the query I have written, I'm just not sure how to get it to work with two db's. $sql = "SELECT cdb.ca.achievement, cdb.c.name, cdb.c.race, cdb.c.class, cdb.c.gender, cdb.c.level, vb.a.name FROM cdb.characters c, cdb.character_achievement ca, vb.achievements a WHERE cdb.c.guid = cdb.ca.guid AND cdb.ca.achievement = vb.a.id ORDER BY cdb.ca.date DESC LIMIT 100 ;"; Any help would be very much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/204000-mysql-query-from-two-different-dbs-on-two-diff-servers/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 6, 2010 Share Posted June 6, 2010 Queries are specific to a connection and execute on the database server. Since you will need two separate connections/two separate database servers, you would need to execute two different queries and tie the results together in your php script or copy (replicate) the data from one server to the other and then use a single query. Quote Link to comment https://forums.phpfreaks.com/topic/204000-mysql-query-from-two-different-dbs-on-two-diff-servers/#findComment-1068464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.