Malcolm,
I endorse Ted's comments on Joe Celko's "SQL for Smarties" which is an
excellent book. In my paper I do mention his work. However, he seems to
advocate Nested Sets when dealing with Hierarchical data which are a little
bit messy to deal with and tend to over complicate the problem. I adopted
the adjacency model which is effectively the methodology you are using.

I have posted my short white paper and associated source code:

www.Replacement-Software.co.uk/vfp/Hierarchical_Data_in_VFP.zip

Hope it helps with your problem.

Dave Crozier


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Malcolm Greene
Sent: 08 October 2008 16:16
To: [email protected]
Subject: Hierarchical query

I have have table with 2 columns: cParent and cChild. cParent may
be a child of other cParents. Likewise cChild may be a cParent to
other children.
Is there a simple SQL query I can use to produce a list of all
cParent children through an arbitary depth?
Is there a way to capture the depth of each child so I could
visually indent parent/child hierarchies?
What happens if I have a circular reference, eg. a grandchild
that has its top parent as a child? (in theory this shouldn't
happen with my data, but ....)
Thank you,
Malcolm


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to