Jump to content

mysql query from two different db's on two diff servers


Fog Juice

Recommended Posts

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.