薪酬核算人员重复,什么原因?

薪酬核算人员重复,什么原因?
【关键字】:员工管理、薪酬核算、人员重复
【适用版本】:通用
【解决方案】:
  选取一个重复的员工,按下面步骤操作。
1、select fid from t_bd_person where fnumber =’重复的人员编码’
2、SELECT “T0″.”FID” “ID”, “T0″.”FPERSONID” “T1.ID”,
“T1”.”FNAME_L2″ “T1.NAME”, “T1”.”FNAME_L1″ “T1.NAME_L1”,
“T1”.”FNAME_L2″ “T1.NAME_L2”, “T1”.”FNAME_L3″ “T1.NAME_L3”,
“T0″.”FADMINORGID” “T2.ID”, “T2”.”FNAME_L2″ “T2.NAME”,
“T2”.”FNAME_L1″ “T2.NAME_L1”, “T2”.”FNAME_L2″ “T2.NAME_L2”,
“T2”.”FNAME_L3″ “T2.NAME_L3”, “T0″.”FPOSITIONID” “T3.ID”,
“T3”.”FNAME_L2″ “T3.NAME”, “T3”.”FNAME_L1″ “T3.NAME_L1”,
“T3”.”FNAME_L2″ “T3.NAME_L2”, “T3”.”FNAME_L3″ “T3.NAME_L3”
from “T_HR_EMPORGRELATION” “t0”
left OUTER JOIN “T_BD_PERSONHIS” “t1”
on ((“T0″.”FPERSONID” = “T1″.”FHISTORYRELATEID”
and (“T1″.”FEFFDT” <= “T0″.”FEFFDT”))
and (“T1″.”FLEFFDT” >= “T0″.”FEFFDT”))
left OUTER JOIN “T_ORG_ADMINHIS” “t2”
on ((“T0″.”FADMINORGID” = “T2″.”FHISTORYRELATEID”
and (“T2″.”FEFFDT” <= “T0″.”FEFFDT”))
and (“T2″.”FLEFFDT” >= “T0″.”FEFFDT”))
left OUTER JOIN “T_ORG_POSITIONHIS” “t3”
on ((“T0″.”FPOSITIONID” = “T3″.”FHISTORYRELATEID”
and (“T3″.”FEFFDT” <= “T0″.”FEFFDT”))
and (“T3″.”FLEFFDT” >= “T0″.”FEFFDT”))
where ((((“T0″.”FASSIGNTYPE” = 1
and “T1″.”FHISTORYRELATEID” = ‘上面语句返回的fid’)
and “T0″.”FISINNER” = 1)
and (“T0″.”FEFFDT” <= {ts ‘2016-06-28’}))
and (“T0″.”FLEFFDT” >= {ts ‘2016-06-28’}))

其中的日期,请改为当前日期,返回的记录是否存在两条或多条,把反馈结果导出到excel表里,可以看出是组织或则岗位存在重复数据,然后把重复的岗位历史或则组织历史删除。
下面语句可以查询是否存在重复组织,如果重复,需要把重复记录删除。
select fhistoryrelateid ,count(*) from t_org_adminhis group by
 feffdt,fleffdt,fhistoryrelateid having
count(*)>1