Removing duplicate rows from table in Oracle

前端 未结 22 1769
醉话见心
醉话见心 2020-11-22 12:57

I\'m testing something in Oracle and populated a table with some sample data, but in the process I accidentally loaded duplicate records, so now I can\'t create a primary ke

22条回答
  •  攒了一身酷
    2020-11-22 13:31

    From DevX.com:

    DELETE FROM our_table
    WHERE rowid not in
    (SELECT MIN(rowid)
    FROM our_table
    GROUP BY column1, column2, column3...) ;
    

    Where column1, column2, etc. is the key you want to use.

提交回复
热议问题