本文介绍了一种使用 SQL 语句来删除数据库表中重复的商品记录的方法。通过组合子查询与条件判断,可以有效地移除那些 goodsurl 相同但 id 不同的冗余条目,确保数据的唯一性和准确性。
delete the_table as a from the_table as a , (select min(id) as id,goodsurl from
the_table group by goodsurl having count(goodsurl)>1) bwhere a.goodsurl =
b.goodsurl and a.id>b.id