删除重复记录,并保留一条记录
程序员文章站
2022-07-15 08:50:41
...
DELETE from tiaoyaxiang_bk WHERE tyx_id IN (SELECT tyx_id FROM tiaoyaxiang_bk GROUP BY tyx_id HAVING COUNT(tyx_id) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM tiaoyaxiang_bk GROUP BY tyx_id HAVING COUNT(*) > 1);