如题

解决方案 »

  1.   

    insert into table1(字段列表) select 字段列表 from table2 where ......
      

  2.   

    也可以多表联合查询
    insert into table1(字段列表) select 字段列表 from table2,table3 where 关联条件 and/or 其它条件
      

  3.   

    不可以,加where 是跟在其它子句后如
    insert into ...select...  where
      

  4.   

    where 是数据筛选(即查询)的条件,insert 它只是增加与库中已有数据无关,与select 及update不同
      

  5.   

    最典型的 insert into values() 你加不上where 吧
    还有一个 insert into exec 存储过程  你也加不上where吧
      

  6.   

    insert INTO a 
    (
    id
    )
    SELECT
     
    7WHERE 1=1可以的
      

  7.   

    给你举个例子,可以在查询分析器里面执行一下,看看结果:declare @a table(Employee_sn int,CreateDate datetime);
    declare @b table(Employee_sn int,CreateDate datetime)
    insert into @b
    select 1,'2007-01-02'
    union all select 1,'2007-01-05'
    union all select 1,'2007-01-03'
    union all select 3,'2007-01-02'
    union all select 1,'2007-01-04'
    union all select 1,'2007-01-02'
    union all select 2,'2007-01-02'
    select * from @b;
    insert into @a select * from @b where employee_sn=1;
    select * from @a;
      

  8.   

    你看看上面好不好已经说那是跟在select 后
      

  9.   

    从罗辑上说insert 后面是不能直接跟where的
    比如 insert tablename where condition这是肯定不行的