由于在新建表时没有设定主键或者其他原因,导致出现字段完全相等的数据时,删除处理起来变得相当不优雅。
一下是一段摘自CSDN的roy_88的答复
DELETE t FROM (SELECT *,ROW_NUMBER()OVER(PARTITION BY test1,test2,test3,test4 ORDER BY RAND()) AS RN FROM TableName) AS t WHERE RN>1
由于在新建表时没有设定主键或者其他原因,导致出现字段完全相等的数据时,删除处理起来变得相当不优雅。
一下是一段摘自CSDN的roy_88的答复
DELETE t FROM (SELECT *,ROW_NUMBER()OVER(PARTITION BY test1,test2,test3,test4 ORDER BY RAND()) AS RN FROM TableName) AS t WHERE RN>1