select …into 在表不纯在的情况下创建表
insert … select 表已经存在了

解决方案 »

  1.   

    1:
    select …into 就是將生成一個新表。
    如﹕
    select * into newtable from oldtable
    就是將oldtable表Copynewtable。此時newtable和oldtable的表是一樣
    2:
    insert … select 是將select 后面符合條件的記錄插入到表中
    如:
    insert into tableA(a,b,c) select a,b,c from tableB
    注意tableA(a,b,c)與 select a,b,c 的字段結構要一樣
      

  2.   

    select …into  
    是把查询的数据结果保存为一个表,
    若该表尚不存在,会自动创建该表;insert … select
    是把查询的数据结果直接插入一个
    已经存在的表,不产生中间表。
      

  3.   

    楼上说的对,倒数2楼的第一个例子有问题,应该是:
    select oldtabel.* into newtable from oldtable
    也可以对多个表进行,并且可以选择不同的列,如:
    SELECT oldtabel1.*,oldtabel2.column1,oldtabel2.column2
      INTO newtabel
      FROM oldtable1,oldtable2
    这是将oldtable1表的所有行和oldtable2表的第一列,第二列查询出来并写到newtable表中