Deleting duplicates from a large table

前端 未结 5 968
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 02:40

I have quite a large table with 19 000 000 records, and I have problem with duplicate rows. There\'s a lot of similar questions even here in SO, but none of them seems to gi

5条回答
  •  时光取名叫无心
    2021-01-02 02:54

    You can delete duplicates using these steps: 1- Export the following query's results into a txt file:

    select dup_col from table1 group by dup_col having count(dup_col) > 1
    

    2- Add this to the first of above txt file and run the final query:

    delete from table1 where dup_col in (.....)
    

    Please note that '...' is the contents of txt file created in the first step.

提交回复
热议问题