2017-03-16 69 views

回答

1

如果它位于同一台服务器上,则可以引用数据库名称。

SELECT * FROM dbase1.dbo.profile a INNER JOIN dbase2.dbo.profile b 
ON a.id = b.id 
WHERE b.country = 'Philippines' 

查询失败的原因是因为这部分

where dbase1.dbo.profile.id IN (select * from dbase2.dbo.profile.... 

您对dbase2.dbo.profile所有列比较dbase1.dbo.profile.id的, 您的查询会工作如果您将其更改为

where dbase1.dbo.profile.id IN (select id from dbase2.dbo.profile.... 

使您的查询只有一个列比较,另一列

这里假定dbase2.dbo.profile也有一个名为ID的列,它是你所引用的一列

+0

谢谢先生。问题解决。^_ ^ – Likens

相关问题