Bug #82093 Hierarchical and recursive queries
Submitted: 4 Jul 2016 10:03
Reporter: yvs ppt Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any
Tags: hierarchical, recursive query

[4 Jul 2016 10:03] yvs ppt
Description:
Add support of hierachical query.

CONNECT BY 

see https://en.wikipedia.org/wiki/Hierarchical_and_recursive_queries_in_SQL

How to repeat:
As the feature does not exists, it is not reproductible. But consider this table (employee) :

 name        | empno | manager
-------------+-------+---------
 KING        |  7839 |
 JONES       |  7566 |    7839
 SCOTT       |  7788 |    7566
 ADAMS       |  7876 |    7788
 FORD        |  7902 |    7566
 SMITH       |  7369 |    7902
 BLAKE       |  7698 |    7788 
 ALLEN       |  7499 |    7698
 WARD        |  7521 |    7698

The goal is to retrieve all employee under "JONES"

There are actually no way to do this with mysql.

But a simple
select * from employee connect by prior empno=manager start with manager=7839
should be return the expected result