update vs4tteasurytransMB set tttmmoneyincheque=(select TDPMTotal from vs4tcashdepositmb where tdpmtdpsno=tttmnote and tttmln-(select top 1 max(tdpmln) from vs4tcashdepositmb where tdpmtdpsno=tttmnote)=tdpmln) where tttmtypelist='DE'
update vs4tteasurytransMB set tttmmoneyamount=(select TDPMTotal from vs4tcashdepositmb where tdpmtdpsno=tttmnote and tttmln-(select top 1 max(tdpmln) from vs4tcashdepositmb where tdpmtdpsno=tttmnote)=tdpmln) where tttmtypelist='DE'
update vs4tteasurytrans set ttetcancelstatus=(select tdpscancelstatus from vs4tcashdeposit where tdpsno=ttetrefno) where ttetsavefrom='DE'