oracle数据库中怎样删除一个表的重复数据?
展开全部
这个问题就是要删除表中重复的记录,查询的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);
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);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询