标签:io sp c on r bs sql as d
with tmp as ( select a.id,a.name,a.pid from tb a where id=‘003‘ union all select k.id,k.name,k.pid from tb k inner join tmp c on c.id = k.pid
)select * from tmp
sqlserver 递归查询的一种写法
原文地址:http://www.cnblogs.com/hbhzz/p/4010406.html