insert B select id as Bh from A

解决方案 »

  1.   

    insett 表1(编号) select bh from 表2
      

  2.   

    导数据没有要求字段名相同, 只需要字段类型兼容
    而且列的对应关系是按照你在insert 和select 中列出的列顺序一一对应的, 与列名没有任何关系.例如:
    insert 表1 (id, name) select name, id from 编号这句会到 表2.name 导入 表1.id, 把 表2.id 导入 表1.name
      

  3.   

    直接写就行呀insert into 表2(字段1,字段2...)
    select 字段a,字段b....注意字段1和字段a对应,字段2和字段b对应
      

  4.   

    如果相对位置相同,直接:insert 表1(编号) select * from 表2
      

  5.   


    create table T1(编号 int,名称 varchar(100))
    create table T2(bh int, mc varchar(100))insert into T1(编号,名称)
    select bh,mc
    from T2drop table T1,T2