mysql中树状结构的查询(分层查询)

时间:2019-06-07 13:07:02

标签: mysql

SELECT ename,man,(SELECT SUM(t1.pop) 
FROM tree t1 START WITH t1.ename = t2.ename 
CONNECT BY t1.man = PRIOR t1.ename) population 
FROM tree t2 start with t2.man is null connect by prior t2.ename=t2.man;

上面的代码是一个oracle查询。

如何在mariaDB中执行类似于上面的分层查询?

0 个答案:

没有答案