--删除重复外发工序
delete from wwwp where id in (
select max(wwwp.id) id
from wwwp(nolock)
inner join (
select mpsid,mpsmatid,wpid ,count(*) NO from wwwp(nolock)
group by mpsid,mpsmatid,wpid having count(*)>1)T on T.mpsid=wwwp.mpsid and T.mpsmatid=wwwp.mpsmatid and T.wpid=wwwp.wpid
group by wwwp.mpsid,wwwp.mpsmatid,wwwp.wpid
)