I want to copy a tree via a MySQL function. My table structure looks like this:
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
If I copy it it should look like this (remember: id is 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
Is this possible? Are recursiv functions possible in MySQL? MySQL Version is 5.0.95
Best regards ...