SQLServer查询所有子节点

用CTE递归
;with as 
(
select from tab where id=1
union all
select a.* from tab as inner join as on a.pid=b.id
)
select from f
posted @ 2017-05-03 18:19  (john_zhang)  阅读(3101)  评论(0编辑  收藏  举报