pgsql 查询子数据

WITH RECURSIVE x AS
( SELECT *
FROM t_org
WHERE orgid = '10001'
UNION ALL
SELECT b.*
FROM x,t_org b
WHERE x.orgid = b.parentorgid
AND b.status = '1'
)
SELECT * FROM x;

posted @ 2023-04-11 20:19  漫步CODE人生  阅读(53)  评论(0编辑  收藏  举报