树型结构是存储商品分类的
------解决方案--------------------
- SQL code
with cte as( select id from tb where [email protected] union all select a.id from tb a join cte b on a.id=b.pid)select * from cte
with cte as( select id from tb where [email protected] union all select a.id from tb a join cte b on a.id=b.pid)select * from cte