注册 登录
编程论坛 ASP.NET技术论坛

求助:如何实现两个数据库中两个表的数据连接

zhuwj 发布于 2012-09-14 08:34, 550 次点击
比如有两个数据库database1和database2,
database1中有表users(uid,usertypeid,name.....)
database2中有表userstype(usertypeid,typename...)
怎么样实现这两个数据库users  usertype表的连接呢?连接后有这样的数据(uid,typename,name....)
或者建一张存放这样字段的视图
2 回复
#2
belin20002012-09-14 18:30
select t1.field1,t2.field1

from a.table1 as t1,b.table2 as t2

where .....

(前提你的两个数据库用户的用户名,密码一样,确保你的用户可以访问这两个数据库)
#3
蓝献清2013-02-19 13:22
select uid,typename,name from users as database1,userstype as database2 where +条件
1