Mysql 学习笔记 —— 删除某个字段的重复数据
2016, Dec 06
当我们要删除 xyj_works_text 这张表中 works_id 字段重复的数据,我们可以选择保留相同 works_id 中,id 较大的那条纪录,代码如下:
delete from xyj_works_text where id not in (
select id from (
select max(id) as id from xyj_works_text group by works_id
) as b
)