Oracle Start with ... Connect by prior递归查询

假设数据库表结果如下:
评论ID Parent评论ID 状态
评论ID Parent评论ID 状态
commentId parentCommentId status


需求:查询某一条指定状态下评论的所有子评论(包括子评论的子评论)
SELECT ID_ FROM NEO_FORUMCOMMENT WHERE STATUS = ? START WITH ID_= ? CONNECT BY PRIOR ID_=PARENTCOMMENTID 



refer to: http://www.iteye.com/topic/287749

猜你喜欢

转载自pengyao0305.iteye.com/blog/2401592