2\ ALERT TABLE TB_A ADD ID INT IDENTITY(1,1)
DELETE FROM TB_A WHERE ID
NOT IN(SELECT MIN(ID) ID FROM TB_A GROUP BY F_A)
1的条件

解决方案 »

  1.   


    1,select (select count(*) from 表 where f_a>=aa.f_a),f_b,f_c from 表 AA 
      

  2.   

    2,
    ---------------------
    如果有ID字段,就是具有唯一性的字段delect table where id not in (  select max(id) from table group by col1,col2,col3...
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,如果是判断所有字段也可以这样
      select * into #aa from table group by id1,id2,....
      delete table 
      insert into table 
      select * from #aa3,没有ID的情况select identity(int,1,1) as id,* into #temp from tabel
    delect # where id not in (
      select max(id) from # group by col1,col2,col3...)
    delect table
    inset into table(...)
       select ..... from #temp
    col1+','+col2+','...col5 联合主键
    select * from  table where col1+','+col2+','...col5 in (  select max(col1+','+col2+','...col5) from table 
    where having count(*)>1
    group by col1,col2,col3,col4 
    )
    group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。2,
    select identity(int,1,1) as id,* into #temp from tabel
    select * from  #temp where id in (
      select max(id) from #emp where having count(*)>1 group by col1,col2,col3...)
      

  3.   

    假设你的表为table1
    1、
    ?????????????????//
    2、
    select distinct f_a,f_b into #a from table1
    delete from table1
    insert into  table1(f_a,f_b) select f_a,f_b from #a
      

  4.   

    alert table tb_a DROP COLUMN  id
      

  5.   

    ALERT TABLE TB_A ADD ID INT IDENTITY(1,1)
    DELETE FROM TB_A WHERE ID
    NOT IN(SELECT MIN(ID) ID FROM TB_A GROUP BY F_A)alert table tb_a DROP COLUMN  id
      

  6.   

    1、
    select (select sum(1) from 表 where f_d=aa.f_d and f_a<=aa.f_a) f_a,* from 表2、
    alter table tb_a add  newfield int identity(1,1)
    delete tb_a where newfield not in( select min(newfield) from 表 group by f_a)
    alter table tb_a drop column newfield