
update t_bei_transdetail as t
set fbizrefno=(select r.fbillno from t_ifm_rectransbill as r where r.fid = t.fsourcebillid)
where t.fsrcbilltype = 'ifm_rectransbill'
and exists (select fid from t_ifm_rectransbill as b where b.fid = t.fsourcebillid);

update t_bei_transdetail as t
set fbizrefno=(select r.fbillno from t_ifm_transhandle as r where r.fid = t.fsourcebillid)
where t.fsrcbilltype = 'ifm_transhandlebill'
and exists (select fid from t_ifm_transhandle as b where b.fid = t.fsourcebillid);
