delete a from yield_produce a join (select roll_plan_no,in_mat_no,out_mat_no,count(*),max(id) as id,line_no from yield_produce group by roll_plan_no,in_mat_no,out_mat_no,line_no HAVING count(*)>1) b on a.roll_plan_no = b.roll_plan_no and a.in_mat_no = b.in_mat_no and a.out_mat_no= b.out_mat_no and a.line_no=b.line_no where a.id <b.id
mysql 删除重复数据并保留id最大的一条
最新推荐文章于 2024-05-06 10:59:21 发布