mysql递归查询cte
作者:互联网
mysql在8.0.1版本加入了cte递归查询
表结构: || id || pid || name ||
查询id为1的节点以及他所有的子孙节点
with recursive cte as ( select * from tree where id = 1 union all select t.* from tree as t inner join cte on t.pid = cte.id ) select * from cte;
标签:递归,pid,查询,cte,mysql,id,select 来源: https://www.cnblogs.com/zhouxuezheng/p/14855907.html