List:General Discussion« Previous MessageNext Message »
From:Mike Date:January 13 2004 10:11pm
Subject:Re: hierarchical records, I need some help!! ;(
View as plain text  
>I want to have all the items into a recorset with only one query like
>Select id, reference, component from NOMS where reference = '00004'
>but i want not only the primary relations, i want all relations.
>Could somebody help a newbie like me?

It can also help to change the way you look at the relationships, and use nested sets.
With nested sets you do not record the parent-child relationship but rather the range
that a given entity has control of.

So instead of having a manager with an ID of 1 and having three employees with a manager
field pointing to 1, you have three employees numbered 1,2,3 and the manager has a
left_value and a right_value of 0 and 4 respectively.

That is an over-generalization, but check the following links. BTW original credit for the
idea goes to Joe Celko and I reccommend his book "SQL for Smarties".

http://www.sitepoint.com/article/1105 - Tutorial on this that uses PHP
http://www.dbmsmag.com/9603d06.html - More detail from Celko
http://www.dbmsmag.com/9604d06.html - "
http://www.dbmsmag.com/9605d06.html - "
http://www.intelligententerprise.com/001020/celko.shtml
 http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci5 37290,00.html 


Thread
hierarchical records, I need some help!! ;(Victor Reus12 Jan
  • Re: hierarchical records, I need some help!! ;(Martijn Tonies12 Jan
    • Re: hierarchical records, I need some help!! ;(Victor Reus13 Jan
      • Re: hierarchical records, I need some help!! ;(Steve Folly13 Jan
        • Re: hierarchical records, I need some help!! ;(Jochem van Dieten13 Jan
          • Re: hierarchical records, I need some help!! ;(Steve Folly14 Jan
        • RE: hierarchical records, I need some help!! ;(Matt Griffin13 Jan
  • Re: hierarchical records, I need some help!! ;(Mike13 Jan