08-6-16 MySQL 刪除重複項目

delete users_groups as a from users_groups as a,
(
select *,min(id) from users_groups group by uid having count(1) > 1
) as b
where a.uid = b.uid and a.id > b.id;

發表迴響

你的電子郵件位址並不會被公開。