有两个数据库:
A_TABLE 表有如下字段数据 A_TABLE (C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13)B_TABLE 表有如下字段数据 A_TABLE (C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13)
通过某种条件查询A_TABLE表后,如果有条件的记录数据,将符合条件的一条数据就插入到 B_TABLE中。注意,B_TABLE表中比A_TABLE少两个字段
(即 C11,C12)哦。想通过一句Insert 实现。不想通过其他方式,可以吗?谢谢。我是初学,想了解一下。

解决方案 »

  1.   

     insert into  b(C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13) 
    select C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13 from  A where not eixsts(.......)--條件
      

  2.   

    INSERT INTO B_TABLE(C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13) 
    SELECT C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13 FROM  A_TABLE WHERE 条件
      

  3.   

    insert into b_table(C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13)
    select C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13 from a_table where--加条件
      

  4.   

    insert into B_TABLE (C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13)  (select C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C13 from A_TABLE  where ...)