delete from log partition(bt)
where rowid not in (select min(rowid) from log partition(bt) group by USERID,CREATETIME);
请教高人,如何将这个SQL的 NOT IN 改写为exist,谢谢!!
09:50:19 SQL> delete from ddns_log a
09:53:37 2where not exists (select null
09:53:37 3
from ddns_log b
09:53:37 4
group by b.userid,b.createtime
09:53:37 5
having a.rowid=min(b.rowid)
09:53:37 6
);
change to EXISTS:
delete from log partition(bt) a where exists (
select 1 from log partition(bt) b wherea.userid = b.userid and a.createtime=b.createtime and a.rowid > b.rowid);