22 lines
797 B
Transact-SQL
22 lines
797 B
Transact-SQL
create table hrsa_acct_tax_agent
|
|
(
|
|
id bigint primary key ,
|
|
create_time datetime,
|
|
update_time datetime,
|
|
creator bigint,
|
|
delete_type int default 0,
|
|
tenant_key nvarchar(10),
|
|
salary_acct_record_id bigint,
|
|
tax_agent_id bigint,
|
|
salary_month datetime,
|
|
tax_cycle datetime,
|
|
income_category nvarchar(100)
|
|
)
|
|
GO
|
|
|
|
insert into hrsa_acct_tax_agent(id, create_time, update_time, creator, tenant_key, salary_acct_record_id, income_category, tax_agent_id, salary_month, tax_cycle)
|
|
select id, create_time, update_time, creator, tenant_key, salary_acct_record_id, income_category, tax_agent_id, salary_month, tax_cycle
|
|
from hrsa_salary_acct_emp
|
|
where delete_type = 0
|
|
and id in (select max(id) from hrsa_salary_acct_emp group by salary_acct_record_id, income_category, tax_agent_id, tax_cycle)
|
|
GO |