delete * from where x not in (select min(x) from A )
delete from A a where a.rowid > (select min(x.rowid) from A b where a.x = b.x)
min(x.rowid)写错了,应该是 min(b.rowid)
--是这个意思吧 13:31:03 SQL> select * from tb2;NAME TYPE -------------------- ---------- wkc168 dbaa wkc168 168 wkc 18 wkc 28 ycm 21 1* delete from tb2 a where type in (select max(type) from tb2 group by name having count(*)>1) 13:33:05 SQL> /已删除2行。13:33:06 SQL> select * from tb2;NAME TYPE -------------------- ---------- wkc168 168 wkc 18 ycm 21
--2 delete from tb a where exists(select 1 from tb where a.x=x and a.col1>col1); --col1为其他的列
delete from A where rowid in ( select row_id from ( select rowid row_id,row_number() over (partition by X order by rowid ) rn ) where rn <> 1 );
delete from tb2 a where type in (select max(type) from tb2 group by name having count(*)>1) 那种方式,要速度快点?
min(x.rowid)写错了,应该是 min(b.rowid)
--是这个意思吧
13:31:03 SQL> select * from tb2;NAME TYPE
-------------------- ----------
wkc168 dbaa
wkc168 168
wkc 18
wkc 28
ycm 21 1* delete from tb2 a where type in (select max(type) from tb2 group by name having count(*)>1)
13:33:05 SQL> /已删除2行。13:33:06 SQL> select * from tb2;NAME TYPE
-------------------- ----------
wkc168 168
wkc 18
ycm 21
--2
delete from tb a where exists(select 1 from tb where a.x=x and a.col1>col1);
--col1为其他的列
delete from A where rowid in (
select row_id from (
select rowid row_id,row_number() over (partition by X order by rowid ) rn
) where rn <> 1
);
delete from tb2 a where type in (select max(type) from tb2 group by name having count(*)>1)
那种方式,要速度快点?