我想从两个不同的链接服务器连接表。我不知道该怎么做。
首先查询:
SELECT * FROM OPENQUERY(PANTS,'
SELECT
LONG
,SHORT
FROM JEANS
第二次查询:
SELECT * FROM OPENQUERY(SHIRTS,'
SELECT
WHITE
,BLACK
FROM STORES
让我们说长stores
表,我想加入它。我该怎么做?
答案 0 :(得分:1)
根据您提供的查询,您可以这样做:
Select Pants.Long, Pants.Short,
Shirts.White, Shirts.Black
From OpenQuery(PANTS, 'Select Long, Short From Jeans') As Pants
Join OpenQuery(SHIRTS, 'Select White, Black, Long From Stores') As Shirts
On Pants.Long = Shirts.Long;