mysql之删除重复数据

xiaoxiao2021-02-28  28

//删除id重复的数据,适合id是手工主键delete person as a from person as a,(    select *,min(id) from person group by id having count(1) > 1) as bwhere a.id = b.id

                  

//查找name重复的,并且除掉id最小的那个 delete tb_person as a from tb_person as a, ( select *,min(id) from tb_person  group by name having count(1) > 1 ) as b  where a.name = b.name and a.id > b.id;
转载请注明原文地址: https://www.6miu.com/read-2600096.html

最新回复(0)