第1个回答 2012-12-19
这个问题就是要删除表中重复的记录,查询的sql语句如下:
select id,name from (
select id,name,row_numer() over(partition by id,name order by id,name) rn from tableA)
where rn>1;
删除的sql语句如下:
DELETE tableA WHERE ROWNUM = (SELECT ROWNUM
FROM (SELECT id,name,
ROW_NUMBER() OVER(PARTITION BY id,name ORDER BY id,name) RN
FROM tableA )
WHERE RN > 1);本回答被网友采纳
第4个回答 2018-04-11
delete from table
where (id,name) in (
select id,name from table group by id,name having count(1)>1)
and rowid not in (
select min(rowid) from table group by id,name having count(1)>1)