数据库内容,随机编了一些数据,其中认为两个字段Name、Address1一致为重复记录,保留其中一条
- 删除两个字段Name、Address1一致重复的记录,保留一条:
- 找出
select * from tableabc where Name in( select Name from tableabc group by Name, Address1 having count(Name) > 1)
-
- 删除
1 select * from tableabc 2 where Name in( select Name from tableabc group by Name, Address1 having count(Name) > 1) 3 and 4 ID not in(select max(ID) from [mibox].[dbo].[Puzzle] group by Name,Address1 having count(puzzleface) > 1 )
2.