SQL---查询树中某个节点及其所有子节点

with f as 
(
select * from tab where id=1
union all
select a.* from tab as a inner join f as b on a.pid=b.id
)
 
select * from f

  

posted @ 2015-03-09 20:15  框框A  阅读(1452)  评论(0编辑  收藏  举报