BEGIN
  DECLARE sChildList VARCHAR(4000);
  DECLARE sChildTemp VARCHAR(4000);
  SET sChildTemp =cast(rootId as CHAR);
  WHILE sChildTemp is not null
  DO
    IF (sChildList is not null) THEN
      SET sChildList = concat(sChildList,',',sChildTemp);
    ELSE
      SET sChildList = concat(sChildTemp);
    END IF;
    SELECT group_concat(id) INTO sChildTemp FROM xx_area WHERE FIND_IN_SET(parent, sChildTemp) > 0;
  END WHILE;
  RETURN sChildList;
END

 

select getAreaAllChildList(651) areaIds

相关文章:

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