我现时有两个表,一个表table1,另一个table2
表结构如下:
table1:
(fid int,
fname varchar(20),
fex varchar(10),
fage int)table2结构如下:
(fid int,
fname varchar(20),
fsex varchar(10),
fage int,
fperson int,
f varchar(20)
)我想将查找到表table1 符合条件的记录全部记录后,插入到table2中
如:select * from table1 where fage>20 的记录插入到table2中即最终实现表table2记录如下:
fid   fname  sex  fage  fperson f
001    李生   男     21
003    谢工   男     33
005    黄珊   女     25
010    梁山   男     40用sql语句如何实现???   

解决方案 »

  1.   

    insert into table2 select * from table1 where fage>20
      

  2.   

    select * into table2
    from table1
    where fage>20
      

  3.   

    insert into tb2 select * from table1 where fage> 20
      

  4.   

    insert into table2(fid,fname,sex,fage) 
    select fid,fname,sex,fage 
    from table1 where fage>20
      

  5.   

    insert into table2 select fid,fname,sex,fage from table1
    where fage>20