mysql stored procedure that calls itself recursively

后端 未结 4 1964
太阳男子
太阳男子 2020-11-28 14:10

I have the following table:

id | parent_id | quantity
-------------------------
1  | null      | 5
2  | null      | 3
3  | 2         | 10
4  | 2         | 15         


        
4条回答
  •  没有蜡笔的小新
    2020-11-28 14:34

    Take a look at Managing Hierarchical Data in MySQL by Mike Hillyer.

    It contains fully worked examples on dealing with hierarchical data.

提交回复
热议问题