DELETE FROM `repeat_pays`
where (`id`) not in
(
select a.id from
(
select `id` from repeat_pays group by `order_sn` having count(*) > 1
) a
)
– 必须要加
select a.id from
(
…
) a
否则报错:You can’t specify target table ‘repeat_pays’ for update in FROM clause。不能在同一表中查询的数据作为同一表的更新数据。