|
Posted by Tzvika Barenholz on 10/21/44 11:26
Hi all. Here's my problem: I have a tree linking macaddresses (bigints)
in a tree structure. i want to get the path from node a to b.
create table tree1(father bigint , child bigint);
insert into tree1 (father,child) values (100,200);
insert into tree1 (father,child) values (100,300);
insert into tree1 (father,child) values (100,400);
insert into tree1 (father,child) values (200,2000);
insert into tree1 (father,child) values (200,3000);
insert into tree1 (father,child) values (100,4000);
insert into tree1 (father,child) values (2000,11111);
you can see that 100 --> 200 --> 2000 --> 11111
select * from tree1
what i would like is a query that given two parameters returns the path
between
them, in the case of 100,11111 i want to get
100
200
2000
11111
if possible as different rows, but columns will do to.
of course i do not know the legnth of the path. it can be very big
thx in advance
Tzvika
Navigation:
[Reply to this message]
|