批量删除请假重复扣减明细的参考脚本
[适用版本]
通用
[解决方案]
--查询数据
select b.fnumber,b.fname_l2,c.fnumber,a.FProposerID,a.FLeaveBillID,a.FHolidaylimitid
from t_hr_ats_holidaylimitdetail a
inner join t_Bd_person b on a.fproposerid=b.fid
inner join t_hr_AtS_leavebill c on a.FLEAVEBILLID =c.fid
where a.FCHANGETYPE =4
group by b.fnumber,b.fname_l2,c.fnumber,a.FProposerID,a.FLeaveBillID,a.FHolidaylimitid
having count(1)>1
--备份数据
select * into holidaylimitdetail0730 from t_hr_AtS_holidaylimitdetail
--修复数据
delete from t_hr_ats_holidaylimitdetail
where FLEAVEBILLID in(select fleavebillid from t_hr_ats_holidaylimitdetail where FCHANGETYPE =4 group by FProposerID,FLeaveBillID,FHolidaylimitid having count(1)>1
)
and fid not in(select min(fid) from t_hr_ats_holidaylimitdetail where FCHANGETYPE =4 group by FProposerID,FLeaveBillID,FHolidaylimitid having count(1)>1)
and FHOLIDAYLIMITID in(select FHOLIDAYLIMITID from t_hr_ats_holidaylimitdetail where FCHANGETYPE =4 group by FProposerID,FLeaveBillID,FHolidaylimitid having count(1)>1)
批量删除请假重复扣减明细的参考脚本
本文2024-09-22 21:36:58发表“s-hr cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-shr-121213.html