现有两个表A,B,它们有一个共同的字段(关键字段),我要把这两个表合成一个新表C,
我怎么来写这个语句

解决方案 »

  1.   

    select a.field1, a.field2, b.field3, b.field4 from a, b where a.id=b.id
    不知楼主的意思是不是这样!
      

  2.   

    insert into C 
    select * from A
    UNION ALL
    select * from B
      

  3.   

    基本上是用SELECT把两个表联合起来。再重新创建个新表(当然有必要的话),或者索性做个视图。语法不知道再问!嘿嘿
      

  4.   

    select * into C from 
    (select * from A
    UNION 
    select * from B) D
      

  5.   

    select a.field1, a.field2, b.field3, b.field4 intto c from a, b where a.id=b.id
      

  6.   

    insert into C (字段1,字段2)
    select a.字段1,a.字段2 from A as a inner join b as b on a.关键字段=b.关键字段