查询多字段重复数据,删除多字段重复数据


//查询多字段重复数据
select * from t_chk_manage a
where (a.userid,a.create_time) in  (select userid,create_time from t_chk_manage group by userid,create_time
  having count(*) > 1)

  

//删除多字段重复数据

delete from t_chk_manage a where (a.userid,a.create_time) in (select userid,create_time from t_chk_manage group by
 userid,create_time having count(*) > 1) and rowid not in (select min(rowid) from t_chk_manage group by userid,create_time

 having count(*) > 1);

你可能感兴趣的:(查询多字段重复数据,删除多字段重复数据)