How to use exists on this sql statment ?
How to use Exists on this sql statement ?
- update m set m.rohsstatus=RHst.Name from #ManuFacture m
-
- inner JOIN Parts.ROHS Rhh WITH(NOLOCK) ON Rhh.ZPartID=m.PartID
- inner JOIN Nop_AcceptedValuesOption RHst WITH(NOLOCK) on RHst.AcceptedValuesOptionID=Rhh.RoHSStatus AND RHst.AcceptedValuesID=911
i need to update table ManuFacture where part id exist on Parts.ROHS
so i need it as below
update m set m.rohsstatus=RHst.Name from #ManuFacture m
where exists(select 1 from Parts.ROHS)