delete from tab
where tab.rowid not in
(
select ddd.rowid
from tab ddd,
(select col1,col2,col3 from tab group by col1,col2,col3) bbb
where tab.rowid=
(
select ccc.rowid
from tab ccc
where ccc.col1=bbb.col1
and ccc.col2=bbb.col2
and ccc.col3=bbb.col3
and rownum=1
)
)
重复记录的第一条会被保留下来
where tab.rowid not in
(
select ddd.rowid
from tab ddd,
(select col1,col2,col3 from tab group by col1,col2,col3) bbb
where tab.rowid=
(
select ccc.rowid
from tab ccc
where ccc.col1=bbb.col1
and ccc.col2=bbb.col2
and ccc.col3=bbb.col3
and rownum=1
)
)
重复记录的第一条会被保留下来
where a.rowid !=
(
select max(b.rowid) from 表名 b
where a.字段1 = b.字段1 and
a.字段2 = b.字段2
)
DELETE
--select t.*,t.ROWID
from a_t1 t
WHERE t.ROWID <>(
SELECT x.ROWID
FROM a_t1 x
WHERE x.tg2 = t.tg2
AND ROWNUM =1
)