i have two identical table
the first table's structure is like a tree where each record acts like a node.
each node has three field consist of: index as the node-id, item as the represent of item name, parents as pointer to the previous node(index)..
as you can see at the picture each node related to each other based on their parent-index field relation
now what i wanna do is traversing each node(record) to the root, then arrange them into a new table with the same structure, so later on the 2nd table will have 21 records as seen on picture
i'm using vb.net and for next looping to loop the index of each row, then insert each row into a new table.. but the problem is how can i ** copy the data from 1st table to 2nd table with condition parent-child **
here's the picture
i think this case need a recursion method, so in mysql what method should i use to create that? i googled about self join but can't find the right implementation to my problem.