INSERT INTO table2 (c1dm1,c1dm2)
  SELECT '用来替换的值'
         c1dm
    FROM table1
   WHERE c1mc = '你的值'
     and c1dm <> '用来替换的值'

解决方案 »

  1.   

    insert into table2 
     select b.cldm1, a.clmc from table1 as a left join
       (select min(cldm) as cldm1, clmc from table1 group by clmc) as b on a.clmc = b.clmc
      

  2.   


    insert into table2
    select a.cldm,b.cldm from table1 a,
    (select max(cldm),clmc from table1 group by clmc having count(*)>1) b
    where a.clmc=b.clmc
      

  3.   

    insert into table2
    select a.cldm,b.aa from table1 a,
    (select max(cldm) as aa,clmc from table1 group by clmc having count(*)>1) b
    where a.clmc=b.clmc