weaver-hrm-salary/resource/wiki/薪资档案重复.sql

6 lines
424 B
SQL

select max(id) FROM hrsa_salary_archive where tax_agent_id = 35 and delete_type = 0 GROUP BY employee_id HAVING COUNT(employee_id)>1;
update hrsa_salary_archive set delete_type =3 where tax_agent_id = 35 and delete_type = 0
and id in (select max(id) FROM hrsa_salary_archive where tax_agent_id = 35 and delete_type = 0 GROUP BY employee_id HAVING COUNT(employee_id)>1);