LEFT JOIN 和 INNER JOIN
delete t1 from tdb_goods as t1 LEFT JOIN (select goods_id,goods_name from tdb_goods GROUP BY GOODS_NAME having count(goods_name)>=2 )as t2 on t1.goods_name = t2.goods_name where t1.goods_id >t2.goods_id;
实测用INNER JOIN也可以 为什么不用INNER呢 感觉更合逻辑? 这里的话感觉JOIN没有实际意义 只是引出了后边t2表的定义。