update comp_control_acct_setup a, _ref_control_acct_setup b set accountid = (select id from comp_chart_of_acct where companyid=a.companyid and acctcode = b.defaultAcctCode) where a.accountid = 0 and a.accountCode = b.name and a.companyID = 93