Welcome Guest, Not a member yet? Register   Sign In
all ideas welcome... interesting db foreign keys question - hierarchy database stuff
#2

[eluser]n0xie[/eluser]
Of the top of my head I would use a tail recursive function that walks all tree paths. The theorie is something like this:

1. Get 1st resultset.
2. Add resultset to 'resultarray'.
--- recursion ---
3. Loop over each result. For every result add them to the resultarray if they are not already present
4. Goto 3 untill no 'new' results are found.
--- /recursion ---
5. return 'the resultarray'.

It depends a bit on how big it is going to get. I could see a LOT of queries if you do it my way...


Messages In This Thread
all ideas welcome... interesting db foreign keys question - hierarchy database stuff - by El Forum - 05-07-2009, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB