UPDATE VS4TEmpSlipMB Set TSmbTDivcode=(SELECT TEmpTDivCode FROM Vs4TEmployee inner join VS4TEmpSlipDoc 
on VS4TEmpSlipDoc.TEpsTEmpCode=Vs4TEmployee.TEmpCode WHERE VS4TEmpSlipDoc.tepsno=VS4TEmpSlipMB.TSmbTEpsNo and VS4TEmpSlipDoc.TEpsCheckGroup=0)
WHERE TSmbTDivcode='' or TSmbTDivcode is null
GO