oracle--删除表中指定字段重复值

来源:互联网 发布:建筑工程定额软件 编辑:程序博客网 时间:2024/06/09 14:30

tbl表中有两个字段:name,price
create table tbl(name,varchar2(20),price number(10));

delete from tbl where rowid not in(select max(t1.rowid) from tbl t1 group by t1.price);

虽然删除了指定字段中重复的值,但会为其保留最后一个值,也就是说,如果字段中有n条重复的,则第n个将被保留.