曾经不会的

1、从一张表中查询出,相同id的数据的所有信息

select * from 表 where id in(select id from 表 group by id having count(*)>1);

2、从一张表中删除,code重复的数据

delete from area a where a.id>(select min(id) from area b where a.code=b.code );

3、从一张表中查询出,去掉code重复的数据

select * from area a where a.id in (select min(id) from area b where a.code=b.code);

原文地址:https://www.cnblogs.com/hy928302776/p/3248263.html