DELETE FROM dashboard_issues WHERE id NOT IN (SELECT temp.min_id FROM (SELECT MAX(id) min_id FROM dashboard_issues GROUP BY code )AS temp);
把数据库:test(数据库)->test(数据表)->key(字段)设置unique 索引为例:
alter table test add unique index (`key`); //创建unique索引
alter table test drop index `key`; //删除key键 unique索引
作者:willeny
链接:https://www.jianshu.com/p/89e620c0f246
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。