在两个不同数据库中的表之间联接? [英] Join between tables in two different databases?
本文介绍了在两个不同数据库中的表之间联接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MySQL中,我有两个不同的数据库-我们称它们为 A 和 B .
In MySQL, I have two different databases -- let's call them A and B.
是否可以在数据库 A 中的表与数据库 B 中的表之间进行联接?
Is it possible to perform a join between a table that is in database A, to a table that is in database B?
推荐答案
是的,假设该帐户具有适当的权限,则可以使用:
Yes, assuming the account has appropriate permissions you can use:
SELECT <...>
FROM A.table1 t1 JOIN B.table2 t2 ON t2.column2 = t1.column1;
您只需要在表引用前面加上它所驻留的数据库的名称即可.
You just need to prefix the table reference with the name of the database it resides in.
这篇关于在两个不同数据库中的表之间联接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文