Andy-H Posted May 26, 2011 Share Posted May 26, 2011 Hi, I was wondering if anyone could tell me if it's possible to union two queries when selecting data from two separate databases on two separate hosts and if so, how is it done? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/237510-union-from-2-databases-on-different-hosts/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 26, 2011 Share Posted May 26, 2011 It's not possible to do this in a single query because the query is executed on the database server that you have connected to. Any one query can only access the data that the database server can directly read. Perhaps if you tell us why you need to do this, someone can suggest the best solution, which could range from replicating one of the databases on the other server to querying each separate database and combining the data using php code. Quote Link to comment https://forums.phpfreaks.com/topic/237510-union-from-2-databases-on-different-hosts/#findComment-1220553 Share on other sites More sharing options...
Andy-H Posted May 26, 2011 Author Share Posted May 26, 2011 Its ok now , we did it by querying the databases separately and sorting them with php array with the timestamp as the array keys and krsort to order them, thanks Quote Link to comment https://forums.phpfreaks.com/topic/237510-union-from-2-databases-on-different-hosts/#findComment-1220877 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.