Re: parent/child relationship in the same table.

From: James <jraustin1_at_hotmail.com>
Date: 17 Nov 2001 09:46:50 -0800
Message-ID: <a6e74506.0111170946.26ce1190_at_posting.google.com>


> But what I really want is to get back each row with it's children
> immediately following it like this:
>
> 1, 0, 'one'
> 3, 1, 'child of one'
> 5, 3, 'child of child of one'
> 2, 0, 'two'
> 4, 0, 'four'

T_ParChild
 Id
 ParId
 Data

Here is the psuedo code:
Call A(0)
Function A(par)
 rs = db.execute("Select * from T_ParChild Where ParId = " & par)  While (!rs.EOF)
   child = rs("Child")
   Print par, child, rs("Data")
   Call A(child)
 Loop
End

An oodb can perform the above much faster than relational dbs. In a relational db, the time to resolve the relationships increases with the number of records. In an oodb, the resolution time is not only quicker but constant regardless of number of "records". (http://www.xdb1.com) Received on Sat Nov 17 2001 - 18:46:50 CET

Original text of this message