//删除重复数据
delete
from MT_PL_MATERIALCONFIG
where mt_pl_materialconfig_id in
(select mt_pl_materialconfig_id
from (select max(a.mt_pl_materialconfig_id) as mt_pl_materialconfig_id,
a.ys_materialid,
a.leafblendno
from MT_PL_MATERIALCONFIG a
join (select g.ys_materialid, g.leafblendno
from MT_PL_MATERIALCONFIG g
group by g.ys_materialid, g.leafblendno
having count(*) > 1) b on a.ys_materialid =
b.YS_MATERIALID
and a.leafblendno =
b.leafblendno
group by a.ys_materialid, a.leafblendno) x)
依据分组条件来删除