Remove duplicates using only a MySQL query?

后端 未结 7 1189
死守一世寂寞
死守一世寂寞 2020-11-27 07:55

I have a table with the following columns:

URL_ID    
URL_ADDR    
URL_Time

I want to remove duplicates on the URL_ADDR column

7条回答
  •  借酒劲吻你
    2020-11-27 08:16

    Well, you could always:

    1. create a temporary table;
    2. INSERT INTO ... SELECT DISTINCT into the temp table from original table;
    3. clear original table
    4. INSERT INTO ... SELECT into the original table from the temp table
    5. drop temp table.

    It's clumsy and awkward, and requires several queries (not to mention privileges), but it will do the trick if you don't find another solution.

提交回复
热议问题