I have 2 tables in different databases in different mysql hosts. can i write a single SQL statement to implement the inner join operation?
-
1possible duplicate of PHP-Mysql table join from different hostShakti Singh– Shakti Singh2012-03-31 06:40:28 +00:00Commented Mar 31, 2012 at 6:40
-
Does this answer your question? Join tables from two different serverNico Haase– Nico Haase2023-05-26 08:58:28 +00:00Commented May 26, 2023 at 8:58
Add a comment
|
4 Answers
Depending on your MySQL version, you might be be able to use Federated Storage Engine. Refer to Accessing Distributed Data with the Federated Storage Engine for more information.
Comments
it is not possible to connect to two databases in same query
2 Comments
Fabrizio
to two database it is possible:
SELECT db1.tb1.* FROM db1.tb1 LEFT JOIN db2.tb1 ON db1.tb1.field1 = db2.tb1.field1. The question here was more about hosts than databasesNico Haase
Pretty strange that there are a lot of other answers that claim that this is possible