Delete duplicate rows from table with no unique key

后端 未结 5 436
误落风尘
误落风尘 2021-01-13 09:46

How do I delete duplicates rows in Postgres 9 table, the rows are completely duplicates on every field AND there is no individual field that could be used as a unique key so

5条回答
  •  再見小時候
    2021-01-13 10:17

    You can try like this:

    CREATE TABLE temp 
    INSERT INTO temp SELECT DISTINCT * FROM discogs.releases_labels;
    DROP TABLE discogs.releases_labels;
    ALTER TABLE temp RENAME TO discogs.releases_labels;
    

提交回复
热议问题