How to delete duplicates on a MySQL table?

后端 未结 25 2956
遇见更好的自我
遇见更好的自我 2020-11-22 01:35

I need to DELETE duplicated rows for specified sid on a MySQL table.

How can I do this with an SQL query?

         


        
25条回答
  •  生来不讨喜
    2020-11-22 02:10

    Could it work if you count them, and then add a limit to your delete query leaving just one?

    For example, if you have two or more, write your query like this:

    DELETE FROM table WHERE SID = 1 LIMIT 1;
    

提交回复
热议问题