1.
create table tab_bak as 
           select id,..., from tab 
                   where id in (
                        select id,count(id) from tab having count(id)>1)
                    )
            group by id;
2. delete from tab where id in (select id from tab_bak);3.insert into tab as select * from tab_bak ;

解决方案 »

  1.   

    DELETE FROM tab
    WHERE ROWID!=(SELECT MAX(ROWID) FROM tab D WHERE tab.id=D.id);或delete from tab a 
    where rowid<(select max(rowid) from tab where id=a.id);
      

  2.   

    delete from tab
    where rowid in
    (
        select rowid from (
              select id,rowid,from tab
              where id in(
                      select id,count(id) from tab having count(id)>1
               )
              group by id;
         )
    )