DELETE FROM `t_ebike_operation_move_after_order` AS c WHERE c.`one_move_id` IN ( SELECT `one_move_id` FROM ( SELECT `one_move_id` FROM `t_ebike_operation_move_after_order` GROUP BY `one_move_id` HAVING COUNT( 1 ) >= 2 ) b ) AND c.`id` NOT IN ( SELECT a.`max_id` FROM ( SELECT `one_move_id`, max( `id` ) AS `max_id` FROM `t_ebike_operation_move_after_order` GROUP BY `one_move_id` HAVING COUNT( 1 ) >= 2 ) a );
其中one_move_id字段是需要设置成唯一值。