如何使用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