📜  mysql 5.6 分层递归查询 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:20.045000             🧑  作者: Mango

代码示例1
select  id,
        name,
        parent_id 
from    (select * from products
         order by parent_id, id) products_sorted,
        (select @pv := '19') initialisation
where   find_in_set(parent_id, @pv)
and     length(@pv := concat(@pv, ',', id))