That's not quite true Dan, you can join one table to another. Select ParentID from Contacts t1, left outer join ChildID from Contacts t2 where t1.ParentID = t2.ParentID.

Cannot try it right now - my system just ate my R:Base but I have done this sort of thing in the past.
Albert

On 15/03/2012 11:33 AM, Dan Goldberg wrote:
The problem is rbase cannot join tables to itself and does not recurse itself.. That is why you have to use nested cursors.
Dan Goldberg
*From:* Ben Petersen <mailto:[email protected]>
*Sent:* Thursday, March 15, 2012 10:18 AM
*To:* RBASE-L Mailing List <mailto:[email protected]>
*Subject:* [RBASE-L] - Re: Exploding BOM
I looked a little further, this link is much better with examples and code.

http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/



On Thu, Mar 15, 2012 at 9:36 AM, Ben Petersen <[email protected] <mailto:[email protected]>> wrote:

    Karen,

    Take a look a "nested sets".

    http://en.wikipedia.org/wiki/Nested_set_model
    http://www.sqlteam.com/article/more-trees-hierarchies-in-sql

    It takes a minute or two to wrap your head around, but is an
    elegant solution (I think) to what you're proposing -- with
    unlimited levels. No cursors, but could be write intensive if that
    is a concern, though I wouldn't imagine any more than a cursor loop.

    Ben





    On Thu, Mar 15, 2012 at 8:55 AM, <[email protected]
    <mailto:[email protected]>> wrote:

        Dan:  That's the way I was going to go, a definite number of
        cursors.  I feel
        better knowing that at least one person did it in that
        manner!   I'll give it a while
        and if no one has code for unlimited levels, then I'll just go
        with that.  Thanks!

        Karen


        In a message dated 3/15/2012 10:44:55 AM Central Daylight
        Time, [email protected] <mailto:[email protected]> writes:

        I use cursors. I just set up for expected level of boms that
        we could possibly imagine using. We only go to a max of 6
        levels down into the bom so I put in 8 cursor levels to just
        in case and put an error message if it finds something below
        8 levels so I can add more someday.

        I know Rbase does not support celko’s nested boms so I use
        cursors instead.

        Dan






Reply via email to