select * from( select * from [数据库名A].dbo.表A where 条件) a,( select * from [数据库名B].dbo.表B where 条件) bwhere a.字段 = b.字段