SELECT catalogid, foldername, parentid, folderpath
FROM public.ic_catalog; --查询同表中的,该节点写的所有子节点
WITH RECURSIVE T(catalogid,foldername,parentid) AS(
SELECT catalogid,foldername,parentid FROM ic_catalog WHERE catalogid =19400
UNION ALL
SELECT T1.catalogid,T1.foldername,T1.parentid
FROM ic_catalog T1 JOIN T ON T1.parentid=T.catalogid
)
SELECT catalogid,foldername,parentid FROM T
05-01 02:03