删除数据库字段一样的row, 并增加唯一索引


DELETE FROM `groups` WHERE name IN (select a.name from ( SELECT name FROM `groups` GROUP BY name HAVING count(name) > 1 ) a);


alter table `groups` add UNIQUE KEY `name` (`name`);
posted @ 2018-12-27 14:18  ma_fighting  阅读(199)  评论(0编辑  收藏  举报
历史天气查