如何使用SQL查询连接来自不同数据库的两个表 [英] How to join two tables from different database using sql query
本文介绍了如何使用SQL查询连接来自不同数据库的两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
推荐先生,
我正在使用vb.net开发Windows应用程序,
我在其中有两个不同的数据库文件,分别是abc.mdb和xyz.mdb
我想形成一个SQL查询,以连接来自两个不同数据库文件的表..
我该怎么办..
请帮帮我..
谢谢..
Respected sir/s,
I am developing windows application using vb.net,
In which i have two different database files say abc.mdb and xyz.mdb
i want to form a SQL query for joining tables from two different database file..
how can i do this..
please help me..
thank you..
推荐答案
如果它们在同一实例中,请使用此声明
if they are in the same instance use this statment
select * from Database1.dbo.Table1 t1
inner join Database2.dbo.Table2 t2
on t1.pkfield = t2.fkField
其他
使用称为链接服务器的东西
else
use some thing called linked server
这篇关于如何使用SQL查询连接来自不同数据库的两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文