insert into tax_master (companyid, code,name,taxtype,taxpercentage,taxClass,taxgroup,description,taxaccount,status,createdby) select 2,code,name,taxtype,taxpercentage,taxClass,taxgroup,description,(select id from comp_chart_of_acct where companyid=2 and acctcode= _ref_tax_master.defaultTaxAccount) as taxaccount,status,createdby from _ref_tax_master where code not in (select code from tax_master where companyid =2)