Oracle数据去重保留一条
多个条件分组
delete from M_BASEPRICE_0719_CC m where (m.brand_code,m.supplier_code,m.part_code_m) in (select brand_code,supplier_code,part_code_m from M_BASEPRICE_0719_CC group by brand_code,supplier_code,part_code_m having count(*) > 1) and rowid not in (select min(rowid) from M_BASEPRICE_0719_CC group by brand_code,supplier_code,part_code_m having count(*) > 1);
单个条件分组
delete from M_BASEPRICE_JL m where m.part_code_m in (select part_code_m from M_BASEPRICE_JL group by part_code_m having count(*) > 1) and rowid not in (select min(rowid) from M_BASEPRICE_JL group by part_code_m having count(*) > 1);
注意:多个条件分组的in前后必须是多个条件,不然会多删,血的教训,假如几百万条数据,删多了再补就很麻烦的