我以前这样做过
insert into table1
SELECT from table2
where tiaojian='1'
这样就能把table2中所有tiaojian字段中是1的记录插入到table1中我现在想把这样insert into table1('re')values
   SELECT distinct re from table2
where re in('A,'B','C') --ABC会有重复的所以加了 distinct
 就是把table2中满足条件的记录中的一个字段插入table1中的某个字段中

解决方案 »

  1.   


    insert   into   table1('re')
    SELECT re from table2 
    where re in('A,'B','C') 
    group re 
      

  2.   


    insert   into   table1('re')
    SELECT re from table2 
    where re in('A','B','C') 
    group re 
      

  3.   

    insert   into   table1(re)
    SELECT re from table2 
    where re in('A','B','C') 
    group re -- n_n 晕了
      

  4.   

    declare @ta table(id int, timestamp)
    declare @tb table(id int, timestamp)insert @ta(id) select distinct id from @tb
    insert into table1(re)
    SELECT re from table2 
    where re in('A,'B','C')