我有以下数据库:加入不同数据库上的两个表
test
table1 fields: id, password, name, lastname
test2
table2 fields: id
如何选择test
和test2
其中table1
有id
在test2.table2.id
?
我有以下数据库:加入不同数据库上的两个表
test
table1
fields: id, password, name, lastname
test2
table2
fields: id
如何选择test
和test2
其中table1
有id
在test2.table2.id
?
你试过了吗?您只需编写数据库名称test2.dbo.tblFoo
,但您可能需要声明别名(只需在编写实际名称后写一个字)即可。该帐户显然需要对这两个数据库的权限。
SELECT /* stuff */
FROM table1 t1
JOIN table2 t2 ON t1.id = t2.id
我可以在ORM中使用某些功能,例如Hibernate Shards。