我现有两个表,这两个表没有任何联系,但这两个表的结构是一样,类型也一样,只是字段名称不一样
table1表
字段:zd1 zd2 zd3
数据:a    b   c
      e    d   f
      a1   b1  c1
      ..   ..  .. 
table2表
字段:zd4 zd5 zd6
数据:x    y   z
      m    n   p
      x1   y1  z1
      ..   ..  .. 
如何用一条语句来形成这样一个表
字段:zd1 zd2 zd3
数据:a    b   c
      e    d   f
      a1   b1  c1
      x    y   z
      m    n   p
      x1   y1  z1
      ..   ..  .. 

解决方案 »

  1.   

    select * from table1
    union all
    select * from table2
      

  2.   

    select zd1,zd2,zd3 from table1 union select zd4,zd5,zd6 from table2
      

  3.   

    select zd1, zd2, zd3, from table1
    union all
    select zd4 as zd1 , zd5 as zd2 , zd6 as zd3 , from table2
      

  4.   

    select * from table1
    union all
    select * from table2