MySQL查询和删除重复数据
删除表中重复记录,只保留一条:
delete from 表名 where 字段ID in (select * from (select max(字段ID) from 表名 group by 重复的字段 having count(重复的字段) > 1) as b);
查询重复数据
select * from prpmlossitem where CaseNo in (
select CaseNo from prpmlossitem
group by CaseNo
having count(CaseNo) > 1
)