表一
col1 col2 col3
--------------
aa    bb  cc
aa1   bb1 dd
表二 
m1  m2    m3
------------
xx1  xx21   xx31
xx11  xx22   xx23
xx12  xx23   xx33
xx13  xx23   xx32
xx14  xx22   xx32
-----------
想得到的结果表
col1 col2 col3  m1  m2    m3
-------------------------------
aa    bb  cc  xx1  xx21   xx31
aa1   bb1 dd  xx11  xx22   xx23
              xx12  xx23   xx33
              xx13  xx23   xx32
              xx14  xx22   xx32--上面表中的数据是没有规律与逻辑的

解决方案 »

  1.   

    select a.col1,a.col2,a.col3,b.m1,b.m2,b.m3 from 
    (select row_number() over(order by getdate()) no,* from 表1) a
    full join 
    (select row_number() over(order by getdate()) no,* from 表2) b
    on a.no=b.no
      

  2.   

    用的是MSSQL2000 ,动态的序号不太好搞,还有没有别的方法。
    谢谢楼上的朋友
      

  3.   

    用临时表select  no=identity(int,1,1),* into #tb1 from 表1
    select  no=identity(int,1,1),* into #tb2 from 表2select a.col1,a.col2,a.col3,b.m1,b.m2,b.m3 from 
    #tb1 a full join #tb2 b
    on a.no=b.nodrop table #tb1,#tb2