我的问题是跟进此问题:https://stackoverflow.com/questions/33594155/how-to-get-all-children-of-a-parent-row
此查询提供X的子项的所有记录:
with recursive tree as (
select stocklocationid, parentid
from tableA
where stocklocationid = X
union all
select child.tableAid, child.parentid
from tableA child
join tree parent on parent.tableAid= child.parentid
)
select *
from tree;
这有效...但它只能处理一个起点X.
我想用muliple说明点来运行它......
我有一个列表:{12,5,17,18}
,在我的查询中,我需要用X替换每个数字。我如何制作它以便它自动执行并重复删除重复项。
我想要一个包含12,5,17,18及其所有deExdences的单个列表....