我用sql查询出的重复数据,没有办法使用sql来屏蔽
结果如下 
111 123
111 124
121 000
211 311
 
就是在clientdataset中删除一个比如111开头的
变成
111 123
121 124
211 311不是在表中删除,而是在clientdataset中删除

解决方案 »

  1.   

    delete from table where (select count(column1) from table)>1 and column2<>(select min(column) from table )
      

  2.   

    SQL蚂蚁的:去除重复值
    如果有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.   

    你们说的是删除物理表中的东西,clientdataset相当于内存临时表,数据在内存临时表中删除
      

  4.   

    ID  value111 123
    111 124
    121 000
    211 311select ID,max(value) from Tablename group by ID这是在重复的ID内取出最大的,如果象去最小的,换成min就行了
      

  5.   

    落了一点,加个 as  select ID,max(value) as value from Tablename group by ID
      

  6.   

    因为whf给我解决了另一个问题,所以把一半的分给他
    剩下的对我有提示的就多散一些
    谢谢大家了