C#怎样用sql联合多个数据库查询表,这几个表的字段都是一样的。

MoiNaNa 2012-02-08 09:05:20
我是这么连接的select DZInfo.dbo.Brand.*,QRInfo.dbo.Brand.* from DZInfo.dbo.Brand,QRInfo.dbo.Brand
可是它报这个错
FROM 子句中的对象 "QRInfo.dbo.Brand" 和 "DZInfo.dbo.Brand" 具有相同的表现名称。请使用相关名称来区分它们。
...全文
324 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zlb_chen 2012-02-08
  • 打赏
  • 举报
回复
字段重复。如果不是全部一样的,就得把字段一个一个列出来,一样的就用别名来处理
cjh200102 2012-02-08
  • 打赏
  • 举报
回复
字段名重复
老猫五号 2012-02-08
  • 打赏
  • 举报
回复
select * from DZInfo.dbo.Brand union all
select * from QRInfo.dbo.Brand
accomp 2012-02-08
  • 打赏
  • 举报
回复
select DZInfo.dbo.Brand.* from DZInfo.dbo.Brand union all
select QRInfo.dbo.Brand.* from QRInfo.dbo.Brand
是你_不懂 2012-02-08
  • 打赏
  • 举报
回复
select a.*,b.* from table1 as a,table as b where a.id = b.id
手可摘星辰 2012-02-08
  • 打赏
  • 举报
回复
用c#操作把
挨踢直男 2012-02-08
  • 打赏
  • 举报
回复
联接查询的时候,结果集所有的列名不能重复。
select tb1.id as id1 , tb2.id as id2
这样重新指定
sxfgen 2012-02-08
  • 打赏
  • 举报
回复
这么写呢
select a.*,b.* from DZInfo.dbo.Brand a,QRInfo.dbo.Brand b

up....

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧