ORACLE每组只保留一条记录

删除同一组内其他记录

DELETE from memactivities a where exists
(
select 1 FROM
(select Uuid,ci_no,lst_upd_ts,ROW_NUMBER() OVER(PARTITION BY Uuid order by ci_no) rn from ics.memactivities where uuid is not null)b
where a.Uuid=b.Uuid AND a.lst_upd_ts=b.lst_upd_ts and b.rn<>1
)

posted @ 2015-04-29 19:22  顿金  阅读(286)  评论(0编辑  收藏  举报