Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hierarchical tree

Status
Not open for further replies.

Thorsten3

Programmer
Jan 28, 2001
22
JP
I wanted to represent a hierarchical tree in a table. Unfortunately I chose a not very elegant way, by creating a table with as many columns as levels in the tree (see table t_old below). Now I want to change this. I created a new tables (t_new) which contains only three columns (id, structure and father_id).
Question: Is there a command, which fills me the new table (t_new) with the data of t_old without using a script with loops?

t_old
id l1 l2 l3 l4 ...
48 x
62 x sens. sys.
63 x sens. sys. eye
64 x sens. sys. eye lens primordium
65 x sens. sys. eye optic cup
66 x sens. sys. otic vesicle

t_new
id structure father_id
62 sensory system 48
63 eye 62
64 lens primordium 63
65 optic cup 63
66 otic vesicle 62

Thorsten
 
You are in a forum for standard ANSI sql and in standard sql there isnt a statement for traversing a tree structure. Some languages have, mySql and Oralce have.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top