SQL中查询根据parent所有child
发布网友
发布时间:2023-06-08 08:38
我来回答
共1个回答
热心网友
时间:2024-11-26 04:16
with rpl (ID,ParentID) as
(
select ID,ParentID from A where parentId=1
union all
select child.id,child.ParentID from rpl parent, A child where parent.ID=child.ParentID
)
select * from rpl