SELECT
    t3.college_code 
FROM
    (
    SELECT
    t1.college_code,
IF
    ( find_in_set( t1.parent_org_code, @pids ) > 0, @pids := concat( @pids, ',', t1.college_code ), 0 ) AS ischild 
FROM
    ( SELECT college_code, parent_org_code FROM t_college t WHERE t.STATUS = 1 ORDER BY parent_org_code, college_code ) t1,
    ( SELECT @pids := '22300' college_code ) t2 
    ) t3 
WHERE
    t3.ischild != 0





表结构: t_college: id, college_code (机构编码), parent_org_code (父机构编码)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-07-05
  • 2021-12-19
猜你喜欢
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案