delete from poi where id in
(
select id from (
select * from poi where poi_id in
(
select poi_id from poi group by poi_id having count(poi_id) >1
)
and id not in (select min(id) from poi group by poi_id having count(poi_id)>1)
) a
);
poi表,poi_id需要去重的字段,保留最小ID
转载请注明:有客帮 » Mysql重复数据去重保留一条数据