MySQL Forums
Forum List  »  Newbie

Re: Return the level and count of a closure table.
Posted by: Sam Holmes
Date: May 07, 2009 03:18PM

Oh I think I see. The depth field in the slides isn't a level field, rather it's the levels away from an ancestor. This way it states the relationship between a descendant and an ancestor.

But what does the query on slide 76 do? Does it do what I'm trying to do? You said to add "...AND t.level=c.level+1..." to "the" join, but which join? I haven't mentioned any kind of join. Or are you saying use his query? But his query doesn't do what I'm trying to do, which is count the immediate children of a all nodes for every level.

And how doesn't my table represent exactly the tree I drew?

[EDIT] Do you think I should change my level column to a depth column. It seems that it would be more useful. It seems like the level column is a bit redundant.



Edited 1 time(s). Last edit at 05/07/2009 03:23PM by Sam Holmes.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.