22,209
社区成员
发帖
与我相关
我的任务
分享
;with f as
(
select * from tb1 where id=xx
union all
select a.* from tb1 as a inner join f as b on a.parentid=b.id
)
select * from f as a inner join tb2 as b on a.id=b.cid
;with f as
(
select * from tb where id=xx
union all
select a.* from tb as a inner join f as b on a.parentid=b.id
)
select * from f