1:删除重复数据
--第一步:先找到重复数据select ProcInstID from record_errorloggroup by ProcInstIDhaving count(ProcInstID) > 1--查看一下select * from record_errorlog where ProcInstID in (select ProcInstID from record_errorloggroup by ProcInstIDhaving count(ProcInstID) > 1);--第二部 保留ErrorLogID最大的(也就是最新的数据)delete from record_errorlog where ProcInstID in (select ProcInstID from record_errorlog group by ProcInstID having count(ProcInstID) > 1)and ErrorLogID not in (select max(ErrorLogID) from record_errorlog group by ProcInstID having count(ProcInstID )>1);
View Code
如果觉得《步步为营-89-SQL语句(删除重复数据)》对你有帮助,请点赞、收藏,并留下你的观点哦!