How to delete records in the table which are repeated?

前端 未结 6 1906
长情又很酷
长情又很酷 2021-01-25 03:35

Hi Here i came across a situation in which by mistakenly Without dropping the table i have run the batch file of the table which consists of some insert statements in detail

6条回答
  •  醉酒成梦
    2021-01-25 04:04

    First , consider setting your ID fields as AI (auto increasment) and even PK (Primary Key).

    In order to remove those duplicated rows , we will create a new table and will move all those duplicated rows to it. After that , drop that table.

    CREATE TEMPORARY TABLE bad_temp AS SELECT DISTINCT * FROM alert_priority

提交回复
热议问题