从MSSQL表中删除重复项

declare @ids int=1

declare @count int

while @ids<471

begin

select @count=COUNT(*) From LotNO where cLotNO=(select cLotNO From LotNO where Auto_ID=@ids)

if @count>1

begin

delete from LotNO where Auto_ID=@ids

end

select @ids+=1

end

原文地址:https://www.cnblogs.com/leavind/p/3415381.html