Hello all,
I want to generate the parent-child relationship using recursion for the following set of data.
tables are as follows :
A]
section_m : section_id, section_desc, parent_section_id, section_type_id
data : 1, none, 0, 1
2, none, 0, 2
3, products, 2, 2
4, tools, 2, 2
5, electrical, 3, 2
6, mechanical, 3, 2
7, home, 5, 2
8, industry, 5, 2
9, car_repair, 4, 2
10, building_repair, 4, 2
Above entries correspond to fields defined. The first two entries are treated as root for section_type_id -- 1 and section_type_id -- 2. Remaining entries will at different levels depending upon the parent_section_id. Here I have given rows for section_type_id 2. For the section_type_id 1 there will be similar entries.
B] magazine_issue_section_r : mag_id, issue_id, sec_id
data : 1, 1, 3
1, 1, 4
2, 2, 3
2, 2, 5
2, 2, 6
2, 2, 8
3, 3, 3
3, 3, 5
3, 3, 6
3, 3, 7
3, 3, 9 etc.
With the given values for the parameter mag_id, issue_id, section_type_id ;
I want to generate the tree-like structure using recursion method.
will it be possible obtain, with the above mentioned data? Can anybody send me the sample code ?
Looking for the reply.
regards,