RE: An SQL Teaser Question
Posted in 2001
> Steve Romankiw1 wrote: > > > > I would like to generate an Org Chart using SQL. I am able > to generate a list when working from the root. > > However, I have hit a mental block when it comes to > traversing the tree from a branch to leaf. > > > > For example, starting from "Corporate HQ" is easy. Simply > start where "parent is null". > > How do you traverse the org chart when starting at "Div - 1"? Mark Stock wrote one a while back check in the archive. It always amuses me that the guy at the top is the only one with a parent. BTW make sure you trap on the recursion depth so you don't the engine down. I know it's supposed to stop itself (at 32???), but I've never found an engine you couldn't blow apart with recursive SPL. Paul Watson # WF Software Ltd # All answers are +44 1435 674629 # pure fantasy +44 1436 678693 # www.wfsoftware.com/informix #