update t_partner_store_check set is_deleted=1 where id in ( SELECT id from t_partner_store_check a INNER JOIN ( SELECT pop_id,store_id FROM `t_partner_store_check` where is_deleted=0 and check_status=1 GROUP by pop_id,store_id HAVING count(1)>1 )b on a.pop_id=b.pop_id and a.store_id=b.store_id and a.is_deleted=0 and a.check_status=1 and a.id not in ( SELECT t.min_id from ( SELECT pop_id,store_id, min(id) as min_id FROM `t_partner_store_check` where is_deleted=0 and check_status=1 GROUP by pop_id,store_id HAVING count(1)>1 )t ) )
mysql删除每组中重复记录
猜你喜欢
转载自www.cnblogs.com/caohuimingfa/p/9438218.html
今日推荐
周排行