kp
Size: a a a
kp
SS
kp
KK
with recursive prc as (
select t.id
from table t
where t.parent_id is null
union all
select t.id
from table t
inner join prc on t.parent_id = prc.id
where t.id = 'c522e2fa-3db0-48a8-b498-5c051540f34e'
)
select distinct id from prc
KK
KK
KK
ВТ
KK
KK
KK
VY
id (якорная часть).KK
VY
KK
VY
2_
KK
VG