首页 > 数据库 > Oracle > oracle学习总结(二)(转)
在oracle中实现自增型ID,删除数据表中的重复记录
CREATE TABLE "APPTEST" (
"ID" INTEGER primary key NOT NULL,
"MOBILE" nvarchar2(50) NOT NULL
);
delete from APPTEST a where rowid not in (select max(rowid) from APPTEST b where a.mobile=b.mobile);
delete APPTEST where rowid in (
select rid from
(select rowid rid,row_number() over(partition by mobile order by id desc) rn from APPTEST )
where rn > 1) ;来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/8227599/viewspace-933095/ ,如需转载,请注明出处,否则将追究法律责任。