论坛首页 综合技术论坛

查询及删除数据库重复记录的方法

浏览 2966 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2014-04-21  
方法1、通过rowid

select * from db.tbfp03 t1 where t1.rowid > (select min(t2.rowid) from db.tbfp03 t2 where t1.compid = t2.compid and t1.applyno = t2.applyno);


方法2、通过in及分组函数

select t1.* from db.tbfp03 t1 where (t1.compid,t1.applyno) in(select t2.compid,t2.applyno from db.tbfp03 t2
group by t2.compid,t2.applyno having count(*) > 1)
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics