insert into comp_control_acct_setup (refID, companyID, accountCode,accountID, orderNo,createdby)  select ID,7,name, (select id from comp_chart_of_acct where companyid=7 and acctcode=_ref_control_acct_setup.defaultAcctCode) as accountID, orderNo,1 from _ref_control_acct_setup where name not in (select accountCode from comp_control_acct_setup where companyID = 7) 