标签:select 重复 保留 重复记录 分享图片 add 内容 group by png
数据库内容,随机编了一些数据,其中认为两个字段Name、Address1一致为重复记录,保留其中一条
1 select * from tableabc 2 where Name in( select Name from tableabc group by Name, Address1 having count(Name) > 1) 3 and Address1 in( select Address1 from tableabc group by Name, Address1 having count(Address1) > 1)
1 select * from tableabc 2 where Name in( select Name from tableabc group by Name, Address1 having count(Name) > 1) 3 and Address1 in( select Address1 from tableabc group by Name, Address1 having count(Address1) > 1) 4 and ID not in(select max(ID) from tableabc group by Name,Address1 having count(Name) > 1 )
标签:select 重复 保留 重复记录 分享图片 add 内容 group by png
原文地址:https://www.cnblogs.com/sjqq/p/9757398.html