标签:
服务器A,服务器B
select * from(
select a.ID as Hid,a.subjectid as Hsubjectid,b.ID as Lid,b.subjectid as Lsubjectid,c.* FROM OPENROWSET(‘MSDASQL‘,
‘DRIVER={SQL Server};SERVER=A;UID=sa;PWD=***‘,
dbName) as a left join OPENROWSET(‘MSDASQL‘,
‘DRIVER={SQL Server};SERVER=B;UID=sa;PWD=***‘,
dbName) as b on a.subjectid = b.subjectid
left join OPENROWSET(‘MSDASQL‘,
‘DRIVER={SQL Server};SERVER=B;UID=sa;PWD=***‘,
dbName) as c
on c.CourseID = a.ID where a.subjectid = b.subjectid and c.CourseID = a.ID) as T
标签:
原文地址:http://www.cnblogs.com/shiyige-216/p/5648767.html