I have two databases (MySQL) on two different servers, and one table references a table in the other. However, I am unable to point the reference to a specific column in the remote table for some reason. Can someone help?

Thank you!

SELECT a.foo, b.bar
    FROM db1.tableA AS a
    JOIN db2.tableB AS b  ON a.something = b.whatever;

This assumes both "databases" are on the same instance of MySQL on the same server. Otherwise, you need to reword the question.

  • I edited the question... they are on different servers. On the note of same servers, however, I am also trying to figure out MySQL Workbench. Is there a way to perform such a join (same server this time) on specific columns from tables in different databases directly within Workbench? Thank you! – Lori Apr 9 '16 at 2:25
  • 2
    For different servers... See FEDERATED or Spider engines. Or make separate connections in your code and simulate the JOIN. – Rick James Apr 9 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.