select * from 表1
union all
select * from 表2

解决方案 »

  1.   

    估计你市这个意思:select a.* from 表1 where a.ID IN(条件)
    union
    select b.* from 表2 where b.ID IN(条件)
      

  2.   


    union
    合并查询结果
    如楼上
      

  3.   

    可是这两个表的字段并不一样啊!估计union就用不了啦!
      

  4.   

    where a.ID IN(条件) and b.ID in(条件2) and a.id=b.id
    因为我的表1中的id 和表2中的id根本就不一样啊!到底怎么写啊?你表1的ID和表2的ID都不一样了,怎么可能 a.id=b.id
    ,,,你要实现什么样的效果?
    举个例子看看
      

  5.   

    两张表没关系,干嘛一齐Select??不如一次一个Select取更方便。。
      

  6.   

    select tid=identity(int,1,1),* into #t1 from a
    select tid=identity(int,1,1),* into #t2 from b
    if (select count(*) from #t1)>(select count(*) from #t2) 
       select a.*,b.* from #t1 a  left join #t2 b on a.tid=b.tid
    else
       select a.*,b.* from #t2 a  left join #t1 b on a.tid=b.tid
      

  7.   

    表1和表2的关联就是表1的字段>表2的字段
    然后
    表1有一个关联分类表1-1(关联字段ProductID同表1)
    表2有一个关联分类表2-1(关联字段ProductID同表2)(表1-1和表2-1字段相同)现在要求取出表1和表2中的所有数据,这些数据要满足表1和表2的关联分类表中的ProductType字段相同!    
    谢谢啦。。