在两个不同数据库中的表之间连接? [英] Join between tables in two different databases?

查看:41
本文介绍了在两个不同数据库中的表之间连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 MySQL 中,我有两个不同的数据库 -- 我们称它们为 AB.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆