日期:2014-05-16  浏览次数:20656 次

查询出重复数据
select *
  from hlinsuredinfo a
 where (GrpContNo, insuredname, doctype, docNo) in
       (select GrpContNo, insuredname, doctype, docNo
          from (select GrpContNo, insuredname, doctype, docNo, count(*) co
                  from hlinsuredinfo
                 group by GrpContNo, insuredname, doctype, docNo)
         where co > 1)
   and rowid not in (select min(rowid)
                       from hlinsuredinfo
                      group by GrpContNo, insuredname, doctype, docNo
                     having count(*) > 1)

上述sql语句用于查询重复数据,若需要删除,将select * from 改为delete from 即可