select * from t1
union all
select * from t2

解决方案 »

  1.   

    如果你想去除掉两表中重复的记录用:
    select * from t1
    union 
    select * from t2
    否则用
    select * from t1
    union all
    select * from t2
      

  2.   

    结构相同:
    select * into 新表名 in(
    select * from t1
    union all
    select * from t2)
    结构不同:select a.*,b.* into 新表名 from t1 a,t2 b where 1<>1
    insert 新表名(t1表的字段名) select * from t1
    insert 新表名(t2表的字段名) select * from t2
      

  3.   

    insert into t1
    select t2.* from t2 where t2.pk not in(select t3.pk from t1 t3 where t3.pk=t2.pk)/*如果主鍵不只一個字段,則用下面這個語句*/
    insert into t1
    select t2.* from t2 where (t2.pk1+t2.pk2+t2.pk3) not in(select (t3.pk1+t3.pk2_t3.pk3) from t1 t3 where t3.pk1=t2.pk1 and t3.pk2=t2.pk2 and t3.pk3=t2.pk3)
      

  4.   

    记录合并
    删除重复select * from t1
    union 
    select * from t2
    不删除重复
    select * from t1
    union all
    select * from t2
    字段名合并select a.*,b.* into 新表名 from t1 a,t2 b where 1<>1
    insert 新表名(t1表的字段名) select * from t1
    insert 新表名(t2表的字段名) select * from t2
    select * from 新表名
      

  5.   

    这是简单的联合问题如果你想去除掉两表中重复的记录用:
    select * from t1
    union 
    select * from t2
    否则用
    select * from t1
    union all
    select * from t2
      

  6.   

    select * into 新表名 from
    (
      select * from t1
      union
      select * from t2
    ) temp
      

  7.   

    直接把一张表中的数据insert 到另一张表不就行了?