delete from fa_order_account where order_id in (select order_id from (select order_id from fa_order_account a group by a.order_id having count(a.order_id) > 1) as a) and id not in (select id from (select min( id) id from fa_order_account group by order_id having count( order_id)>1) as b)