(1)使用用rowid方法

       查询重复数据:select * from person a where rowid !=(select max(rowid) from person b where a.cardid=b.cardid and a.pname=b.pname);

       删除重复数据:delete from person a where rowid !=(select max(rowid) from person b where a.cardid=b.cardid and a.pname=b.pname);

(2)使用group by方法

     查询重复数据:select * from person where cardid in (select cardid from person group by cardid having count(cardid)>1);

     删除重复数据:delete from person where cardid in (select cardid from person group by cardid having count(cardid)>1) and rowid not in (select min(rowid) from person                                group by cardid having count(cardid)>1);

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2021-11-29
  • 2022-01-09
  • 2022-12-23
  • 2021-06-07
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-09-27
  • 2021-09-07
相关资源
相似解决方案