如果需要查询出  一个人的所有下级(子下级),我们可以使用这个存过

注意:查询所有的下级, 但是不包括自己!

 

Create PROC P_存储过程名字

@ID   int

as

with temp

as

( select * from es_Agents where BelongsAgentOrgID=@ID union all select a.* from es_Agents as a inner join temp as child on a.BelongsAgentOrgID = child.AgentsID )

select * from temp

相关文章:

  • 2021-09-06
  • 2021-07-30
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2022-02-05
  • 2022-02-26
猜你喜欢
  • 2022-03-10
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案