Remove duplicate rows in MySQL

前端 未结 25 3660
囚心锁ツ
囚心锁ツ 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条回答
  •  旧时难觅i
    2020-11-21 05:27

    I found a simple way. (keep latest)

    DELETE t1 FROM tablename t1 INNER JOIN tablename t2 
    WHERE t1.id < t2.id AND t1.column1 = t2.column1 AND t1.column2 = t2.column2;
    

提交回复
热议问题