没看懂insert into table (col1,col2)
select colaa,colaa from...
是要这个样子么

解决方案 »

  1.   

    要不这样也可以:
    建一个临时表,然后将从别的表中查询出的值存储进去!这个语句怎么写?对了我用的是oracle
      

  2.   

    不知道我理解的对不对啊,楼主
    a表:
    a1
    1
    2
    3
    b表:
    b1 b2 b3
    1  2  3
      

  3.   

    使用case函数啊……
    select field1, field2 from A;
    field1  field2
    A        1
    B        2
    C        2
    D        1
    ...insert into B(f1, f2)
    select case when field2 = 1 then f1 else NULL end,
           case when field2 = 2 then f1 else NULL end from A;不知道我写的对不?:)