delete from yourtable where ID not in
 ( select min(ID) from yourtable group by other_field1, 
   other_field2,....);

解决方案 »

  1.   

    建立一个与该表(table_a)字段相同的临时表(table_b),将table_a中的重复数据检索出来放入table_b中,然后再根据table_b中的记录删除table_a中的重复记录即可
      

  2.   

    那你要保留的纪录的id有什么要求吗?
    如果没有我觉得Lastdrop(空杯)就很好
      

  3.   

    select * from table where rowid not in (select min(rowid) from table group by column1...);
    可以找出重復數據。
      

  4.   

    同样:
    delete from table a where rowid>(select min(rowid) from table b where a.usrid=b.usrid);
      

  5.   

    其中,usrid可以换成泥表中的任一条件字段
      

  6.   

    用以下这类的操作非常的慢,我仅仅查一个万把条的记录,过了五分钟了结果还没有出来
    select * from table where rowid not in (select min(rowid) from table group by column1...);
      

  7.   

    其实你在创建表的同时可以在容易出现重复的字段设置为primary key,以后就不回出现重复的情况了
      

  8.   

    可以先找出重复的记录,用那个牵套的sql语句速度会有影响,用group by和having
    例如:select NO,COUNT(NO)  from table group by NO having count(NO)>1
      

  9.   

    delete atable
    where exists(select * from atable t 
                 where t.id <> atable.id
                   and t.col01 = atable.col01
                   and t.col02 = atable.col02
                   ...)
      

  10.   

    delete from a a where a.rowid!=(select max(rowid) from a b where a.bm=b.bm and a.mc=b.mc);
      

  11.   

    删除重复列的方法(1) DELETE FROM table_name A WHERE ROWID > (
           SELECT min(rowid) FROM table_name B
            WHERE A.key_values = B.key_values);
    (2) create table table2 as select distinct * from table1;
         drop table1;
         rename table2 to table1;
    (3) Delete from mytable where rowid not in(
           select max(rowid) from mytable
           group by column_name );
    (4) delete from mytable t1
          where  exists (select 'x' from my_table t2
                       where t2.key_value1 = t1.key_value1
                         and t2.key_value2 = t1.key_value2
                         ...
                         and t2.rowid > t1.rowid);