分类分类
2015-06-28 00:00作者:网管联盟
你是不是有一个表的某个字段中有重复的记录?但是你只想保留一条?
如果只保留最后一条,那么执行:
delete
from yourtable A
where exists (Select '1 ' from yourtable B
where A.ID = B.ID
and A.ROWID < B.ROWID);
如果只保留第一条,那么执行:
delete
from yourtable A
where exists (Select '1 ' from yourtable B
where A.ID = B.ID
and A.ROWID > B.ROWID);
相关文章