select a.*,b.* from t1 a,t2 b

解决方案 »

  1.   

    哦你要生成t3 
    select a.a as e,b.b as f into t3 from t1 a,t2 b
      

  2.   

    LEFT JOIN 或 LEFT OUTER JOIN。 
    左向外联接的结果集包括 LEFT OUTER 子句中指定的左表的所有行,而不仅仅是联接列所匹配的行。如果左表的某行在右表中没有匹配行,则在相关联的结果集行中右表的所有选择列表列均为空值。RIGHT JOIN 或 RIGHT OUTER JOIN。 
    右向外联接是左向外联接的反向联接。将返回右表的所有行。如果右表的某行在左表中没有匹配行,则将为左表返回空值。FULL JOIN 或 FULL OUTER JOIN。 
    完整外部联接返回左表和右表中的所有行。当某行在另一个表中没有匹配行时,则另一个表的选择列表列包含空值。如果表之间有匹配行,则整个结果集行包含基表的数据值
      

  3.   

    注意哦,我需要的表是
    t3(e,f)
    1 00
    1 01
    1 02
    1 03
    1 04
    1 05
    2 00
    2 01
    2 02
    2 03
    2 04
    2 05
    3 00
    3 01
    3 02
    3 03
    3 04
    3 05
    这样的。
      

  4.   


    select cast(a.a as varchar(1))+' '+b.b as [t3(e,f)] into t3  from t1 a,t2 b
    --------------------------------------------------------------------------
    t3(e,f)
    1 00
    1 01
    1 02
    1 03
    1 04
    1 05
    2 00
    2 01
    2 02
    2 03
    2 04
    2 05
    3 00
    3 01
    3 02
    3 03
    3 04
    3 05(所影响的行数为 18 行)
      

  5.   

    select cast(a.a as varchar(1))+' '+b.b as [t3(e,f)] into t3  from t1 a,t2 b
      

  6.   

    select a,b from t1 , t2
    FULL [OUTER]:
    指定在结果集中包含左表或右表中不满足联接条件的行,并将对应于另一个表的输出列设为 NULL。这是对通常由 INNER JOIN 返回的所有行的补充。
    LEFT [OUTER]:指定在结果集中包含左表中所有不满足联接条件的行,且在由内联接返回所有的行之外,将另外一个表的输出列设为 NULL。
    RIGHT [OUTER]:指定在结果集中包含右表中所有不满足联接条件的行,且在由内联接返回的所有行之外,将与另外一个表对应的输出列设为 NULL。看示例就明白了:
    create table t1 (a char(2))
    create table t2 (b char(2))
    go
    insert into t1 values('01')
    insert into t1 values('02')
    insert into t1 values('03')
    insert into t1 values('08')
    insert into t1 values('09')insert into t2 values('00')
    insert into t2 values('01')
    insert into t2 values('02')
    insert into t2 values('03')
    insert into t2 values('04')
    insert into t2 values('05')
    go
    select a,b from t1 full outer join  t2 on t1.a=t2.b
    select a,b from t1 right outer join  t2 on t1.a=t2.b
    select a,b from t1 left outer join  t2 on t1.a=t2.b
    go
    drop table t1
    drop table t2--结果:
    a    b    
    ---- ---- 
    NULL 00
    01   01
    02   02
    03   03
    NULL 04
    NULL 05
    09   NULL
    08   NULL(所影响的行数为 8 行)a    b    
    ---- ---- 
    NULL 00
    01   01
    02   02
    03   03
    NULL 04
    NULL 05(所影响的行数为 6 行)a    b    
    ---- ---- 
    01   01
    02   02
    03   03
    08   NULL
    09   NULL(所影响的行数为 5 行)
      

  7.   

    不知道是不是我没有说明白,t3中有两个字段,e,f
    e字段是从t1中取出来的,f是从t2中取出来的。要注意哈变化。
    1 00
    1 01
    1 02
    1 03
    1 04
    1 05
    2 00
    2 01
    2 02
    2 03
    2 04
    2 05
    3 00
    3 01
    3 02
    3 03
    3 04
    3 05
    也就是t1中的每个值都对应t2中的所有值。是这个意思。
      

  8.   

    --不知道楼主,您试过我们的语句了吗? 
    select a.a as e,b.b as f into t3 from t1 a,t2 bselect * from t3
      

  9.   

    恩,我试过了,可以的。谢谢!
    但是,我这里有两条语句,执行后,效果不一样。
    不知道在使用时是按照什么进行分的,怎么才能确定我所要重复的哪个?
    insert into c(FCode,FCus)
    select a.FCode,b.FCode
    from a,binsert into c(FCode,FCus)
    select a.FCode,b.FCode
    from b,a
    请那位GGJJ们帮我解释哈,谢谢!
      

  10.   

    insert into c(FCode,FCus)
    select a.FCode,b.FCode
    from a,binsert into c(FCode,FCus)
    select a.FCode,b.FCode
    from b,a第一个是a连接b
    第二个是b连接a