又是一场大雪过后,天空像海一样蔚蓝,甚至比海更加晶莹剔透。千峰万岭,极目望去,尽是白色,闪耀着一片连接不断的银光。山顶积雪未融,如白银宫网。
使用游标实现
declare @id1 int,@oldid int,@e_REcordid int ,@Olde_REcordid int
DECLARE price CURSOR
FOR SELECT id ,E_recordId FROM evaeve order by E_recordId desc
OPEN price
FETCH NEXT FROM price into @oldid,@Olde_REcordid
while @@fetch_status = 0
begin
FETCH NEXT FROM price
into @id1,@e_REcordidif @Olde_REcordid=@e_REcordid
BEGIN
delete from evaeve where id=@id1
end
set @oldid=@id1
set @Olde_REcordid=@e_REcordid
end
close price
DEALLOCATE price
使用sql语句实现
delete from evaeve where id not in( select max(id) from evaeve group by E_RecordID)
到此这篇关于sql2000数据库清除重复数据的二种方法就介绍到这了。方向对了,剩下的就是坚持。更多相关sql2000数据库清除重复数据的二种方法内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!