码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2015-03-09 20:48:38      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:

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

  

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

标签:

原文地址:http://www.cnblogs.com/beast-king/p/4324408.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!