0
我想通過MySQL函數複製樹。我的表結構是這樣的:通過SQL函數複製樹
id|parent_id|name|position
1|0|rootnode|1
2|1|firstchild|1
3|1|secondchild|2
4|0|anotherroot|2
5|4|anotherchild|1
如果我複製它,它應該是這樣的(記住:id爲AUTOINC):
id|parent_id|name|position
6|0|rootnode|1
7|6|firstchild|1
8|6|secondchild|2
9|0|anotherroot|2
10|9|anotherchild|1
這可能嗎?在MySQL中可以使用recursiv函數嗎? MySQL的版本是5.0.95
最好的問候......從the manual
希望這有助於http://stackoverflow.com/questions/15584013/how-to-find-the-hierarchy-path-for-a-tree-representation/15861254#15861254 – Meherzad 2013-04-29 08:32:20
嗨,我想複製整個樹。我的問題是autoincrement id的再生 - 所以我失去了作業。 – fillibuster 2013-04-29 08:38:21
你可以發佈一些例子... – Meherzad 2013-04-29 08:39:43