DELETE FROM `hao123` WHERE ir_url IN (SELECT ir_url FROM (SELECT ir_url FROM `hao123` GROUP BY ir_url having count(ir_url)>1)a) AND ir_id NOT IN (SELECT * FROM (SELECT min(ir_id) FROM `hao123` GROUP BY ir_url HAVING count(ir_url)>1)b);
hao123:表名。
ir_url:重复列名。
ir_id:在重复的列名中,保留ir_id值最小的,其余的删除,这样可以保证只留下一条数据。
标签:url,ir,navicat,重复,sql,表中,hao123,id,SELECT From: https://www.cnblogs.com/wang--/p/17357190.html