Web Hosting Talk







View Full Version : Joining tables from 2 databases in MySQL


archangel777
06-07-2002, 11:08 PM
Anyone know if it's possible to join 2 tables from 2 different databases in MySQL?

Lats
06-07-2002, 11:16 PM
This (http://www.faqts.com/knowledge_base/view.phtml/aid/5188) may be of some help.


Lats...

ffeingol
06-08-2002, 12:00 AM
As long as the user has permissions in both databases I belive it's quite easy:

select a.col_1, b.col_2
from db1.table_1 a,
db2.table_2 b
where a.col_3 = b.col_3

Just fully qualify the table name with the db name.

Frank