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
)

你可能感兴趣的:(oracle)