查询员工及其上级sql

栏目:s-hr cloud知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

查询员工及其上级sql

--查询所有员工的上级岗位及上级员工
select ADMINP.fdisplayname_l2 "组织全名称",POSITION.Fname_l2 "职位名称",POSITION.fnumber "职位编码",ADMINP.fnumber "组织编码",PERSON.fname_l2 "员工姓名",PERSON.fnumber "员工编码", PPOSITION.Fname_l2 "上级职位名称", PPOSITION.fnumber "上级职位编码" ,PPERSON.fname_l2 "上级员工姓名",PPERSON.fnumber "上级员工编码",PPUSER.FIsDelete "上级用户状态",PPUSER.FForbidden "上级用户状态"
FROM T_BD_PERSON PERSON
LEFT OUTER JOIN T_ORG_PositionMember PM ON PM.FPERSONID = PERSON.FID
LEFT OUTER JOIN T_ORG_Position POSITION ON POSITION.FID = PM.FPOSITIONID
LEFT OUTER JOIN T_ORG_ADMIN ADMINP ON ADMINP.FID = POSITION.FADMINORGUNITID
LEFT OUTER JOIN T_ORG_PositionHierarchy chierarchy on chierarchy.FChildID=POSITION.FID
LEFT OUTER JOIN T_ORG_Position PPOSITION ON PPOSITION.FID = chierarchy.FParentID
LEFT OUTER JOIN T_ORG_PositionMember PPPM ON PPPM.FPositionID = PPOSITION.FID
LEFT OUTER JOIN T_BD_PERSON PPERSON ON PPERSON.FID=PPPM.FPersonID
left outer join t_pm_user PPUSER on PPERSON.FID=PPUSER.FPERSONID
--where ADMINP.fdisplayname_l2 like '环球集团_房地产_深圳区域公司_%'//可指定组织全称模糊匹配查询
-- and fHierarchyID='00000000-0000-0000-0000-000000000001396FCAD0'//可指定查询行政汇报关系上级
order by ADMINP.fdisplayname_l2,PPERSON.fnumber


{:6_153:}
"可指定组织全称模糊匹配查询"只有全称都写了才能查出来,怎么模糊匹配查询呢?
{:5_152:}

查询员工及其上级sql

--查询所有员工的上级岗位及上级员工select ADMINP.fdisplayname_l2 "组织全名称",POSITION.Fname_l2 "职位名称",POSITION.fnumber "...
点击下载文档
分享:
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息