create table hrsa_sob_add_up_rule ( id bigint primary key , create_time datetime, update_time datetime, creator bigint, delete_type int default 0, tenant_key nvarchar(10), salary_sob_id bigint, income_category nvarchar(100), salary_item_id bigint, add_up_column_data_index nvarchar(100) ) GO insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, add_up_column_data_index) select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, salary_item_code as add_up_column_data_index from hrsa_salary_sob_item where delete_type = 0 and income_category = 1 and salary_item_code in ('addUpIncome', 'addUpSubtraction', 'addUpSocialSecurityTotal', 'addUpAccumulationFundTotal', 'addUpEnterpriseAndOther', 'addUpOtherDeduction', 'addUpTaxExemptIncome', 'addUpAllowedDonation', 'addUpTaxSavings') GO insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, add_up_column_data_index) select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, 'addUpTaxPayable' as add_up_column_data_index from hrsa_salary_sob_item where delete_type = 0 and income_category = 1 and salary_item_code = 'addUpAdvanceTax' GO delete from hrsa_sob_add_up_rule where income_category = 1 and add_up_column_data_index in ('addUpTaxPayable', 'addUpAdvanceTax') GO insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, add_up_column_data_index) select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, 'addUpAdvanceTax' as add_up_column_data_index from hrsa_salary_sob_item where delete_type = 0 and income_category = 1 and salary_item_code = 'addUpTaxPayable' GO insert into hrsa_sob_add_up_rule(id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, add_up_column_data_index) select id, create_time, update_time, creator, delete_type, tenant_key, salary_sob_id, income_category, salary_item_id, salary_item_code as add_up_column_data_index from hrsa_salary_sob_item where delete_type = 0 and income_category = 1 and salary_item_code in ('addUpTaxableIncome','addUpTaxFreeIncome','addUpTaxDeduction') GO