24 lines
783 B
MySQL
24 lines
783 B
MySQL
|
|
create table hrsa_acct_tax_agent
|
||
|
|
(
|
||
|
|
id number primary key ,
|
||
|
|
create_time date,
|
||
|
|
update_time date,
|
||
|
|
creator number,
|
||
|
|
delete_type int default 0,
|
||
|
|
tenant_key varchar2(10),
|
||
|
|
salary_acct_record_id number,
|
||
|
|
tax_agent_id number,
|
||
|
|
salary_month date,
|
||
|
|
tax_cycle date,
|
||
|
|
income_category varchar2(100)
|
||
|
|
);
|
||
|
|
/
|
||
|
|
|
||
|
|
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);
|
||
|
|
/
|
||
|
|
|