mysql 删除重复记录,保留最新的一条:
delete from wechat_exchange_address
where open_id in (select open_id from (select open_id from wechat_exchange_address a group by a.open_id having count(a.open_id) > 1) as a)
and id not in (select id from (select max( id) id from wechat_exchange_address group by open_id having count( open_id)>1) as b);
本文介绍如何使用SQL语句删除MySQL表中的重复记录,仅保留每组记录中的最新一条。
2925

被折叠的 条评论
为什么被折叠?



