首页 > 代码库 > 【数据库】 关联多表删除重复数据

【数据库】 关联多表删除重复数据

delete tablefrom table a,(	select b.val1 ,b.val2 ,COUNT(1) as cnt	from table b	group by b.val1 ,b.val2 	haval1g COUNT(1) > 1)bwhere a.val1 = b.val1 and a.val2 = b.val2and a.id not in (	select MAX(id) as id	from table a	group by val1 ,val2 	haval1g COUNT(1) > 1)

  

【数据库】 关联多表删除重复数据