嵌套查询,或者递归查询

使用with as实现嵌套查询和递归查询:

使用WITH AS提高性能简化嵌套SQL

在MySQL中可以使用sql server中可以使用上面的语句进行递归查询

但是在oracle中却不行,oracle中使用下面的语句来进行递归查询:

1 select *
2   from permission_sgdac p
3  start with p.pid = '-1'
4 connect by prior id = pid;

 参考文章: Oracle递归查询

posted @ 2015-07-10 10:18  a ray of sunshine  阅读(230)  评论(0编辑  收藏  举报