MySQL Forums
Forum List  »  Docs

paraent child relation insert in mysql database
Posted by: permander kumar
Date: August 03, 2011 05:11AM

0

--------A
--------A1
--------A11
--------A12
--------A121
--------A2
--------A21
--------A22
--------A221
--------A3
--------A31
--------A311
--------B
--------B1
--------B11
--------B12
--------B121
--------B2
--------B3
--------B31
--------B311
--------C
--------C1
--------C2
--------C21
--------C22
--------C221
--------C3
--------C31
--------C311
--------C32


The above data is insert in mysql database table in following format

ID--------VALUE--------PARENTID
1 -------- A -------- 0
2 -------- B -------- 0
3 -------- C -------- 0
21 ------- B1 ------- 2
22 ------- B2 ------- 2
23 ------- B3 ------- 2
231 ------ B31 ------ 23
31 ------- C1 ------- 3
11 ------- A1 ------- 1
211 ------ B11 ------ 21
111 ------ A11 ------ 11
112 ------ A12 ------ 11
32 ------- C2 ------- 3
1121 ----- A121 ----- 112

and son on......

i have face problem getting the highest value of node id we add new node of that.
for example if we add new node 'B4' in 'B' and 'A23' add in 'A2' node how to get the new node is add in B node in Fourth position and A2 have new node is 'A23'.


Please provide the help about this parent child relation structer.

Appreciate in advance ...............

Options: ReplyQuote


Subject
Views
Written By
Posted
paraent child relation insert in mysql database
3427
August 03, 2011 05:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.