mysql 8.0 单表递归查询
数据结构

SQL
with recursive cte as
(
select * from e_solution where `code`='10001'
union all
select c.* from e_solution as c,cte where c.code=cte.peer_code
)
select * from cte;
结果

官方文档:https://dev.mysql.com/doc/refman/8.0/en/with.html#common-table-expressions-recursive
浙公网安备 33010602011771号