mysql 刪除一樣記錄只保留一條

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)
相關文章
相關標籤/搜索