Subject Re: [firebird-support] Database tree-like structure
Author Martijn Tonies
> 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 :-)

Another way to do this is:

Items
-----
ItemID Integer

Links
-----
ParentID --> Items.ItemID
ChildID --> Items.ItemID


This has no NULLs ...

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com