Subject Re: [firebird-support] Database tree-like structure
Author Alexandre Benson Smith
willy_metra wrote:

>This is great live discussion with experienced people, and i'm using FB
>1.5, so i know my question is a little bit off-topic, i'm sorry...
>I would like to have tree-like structure of my records in a db table.
>What a technique to realize that, please?
>I wonder about some "Parent"-like integer field to identify parent node
>(a record in the same table), but not sure this is a way to go...
>(there could be problem, when browsing to the root is needed, i think)
>Thank you for your kind hints :-)
You could make a self-referencing table example

ID Description Parent
1 Root <null>
2 Node1 1
3 Node2 1
4 SubNode 1.1 2
5 SubNode 1.2 2
6 SubNode 2.1 3
7 SubNode 1.1.1 4

And so on...

Look here (Joe Celko Article)

see you !


Alexandre Benson Smith
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil