with RECURSIVE cte AS
(
select a.id,a.parent_id from org_t a where a.ID=1
UNION ALL
select k.id,k.parent_id from org_t k inner join cte c on c.ID = k.parent_id
) select id from cte;
查找父节点
with RECURSIVE cte AS
(
select a.id,a.parent_id from org_t a where a.ID=40
UNION ALL
select k.id,k.parent_id from org_t k inner join cte c on c.parent_id = k."id"
) select id from cte