What is the best way to remove duplicates from a datatable?

前端 未结 12 2076
醉酒成梦
醉酒成梦 2021-01-02 13:23

I have checked the whole site and googled on the net but was unable to find a simple solution to this problem.

I have a datatable which has about 20 columns and 10K

12条回答
  •  悲哀的现实
    2021-01-02 14:15

    Use a query instead of functions:

    DELETE FROM table1 AS tb1 INNER JOIN 
    (SELECT id, COUNT(id) AS cntr FROM table1 GROUP BY id) AS tb2
    ON tb1.id = tb2.id WHERE tb2.cntr > 1
    

提交回复
热议问题