node (id , name ,parentid); tree (id, parent id) this is my table structure i want 2 store in this procedure i want to insert nodes id with its all parents eg this is node table contents
+----+------+----------+
| id | pid | nodename |
+----+------+----------+
| 1 | NULL | 1 |
| 2 | 1 | 2 |
| 3 | 1 | 3 |
| 4 | 2 | 4 |
| 5 | 4 | 5 |
| 6 | 4 | 6 |
| 7 | 6 | 7 |
+----+------+----------+ so i want to insert in tree(id,pid) table if 4's parent is 2 and 2's parent is 1 ... then i want in tree table both (4,1)and (4,2),, for this i m trying to writ procedure
hw shud i do this?????
den i want 2 traverse tree using single query