查詢多字段重複數據,刪除多字段重複數據


//查詢多字段重複數據
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);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章