Remove duplicate rows in MySQL

前端 未结 25 3458
囚心锁ツ
囚心锁ツ 2020-11-21 04:33

I have a table with the following fields:

id (Unique)
url (Unique)
title
company
site_id

Now, I need to remove rows having same titl

25条回答
  •  走了就别回头了
    2020-11-21 05:25

    -- Here is what I used, and it works:
    create table temp_table like my_table;
    -- t_id is my unique column
    insert into temp_table (id) select id from my_table GROUP by t_id;
    delete from my_table where id not in (select id from temp_table);
    drop table temp_table;
    

提交回复
热议问题