How to select all parents of a node in a hierarchical mysql table?

Good question. In Oracle you would use something like CONNECT BY Since you are using MySQL, I would suggest you change your data structure to efficiently answer that query Here are some ideas.

Good question. In Oracle you would use something like CONNECT BY. Since you are using MySQL, I would suggest you change your data structure to efficiently answer that query.

Here are some ideas.

There was a similar discussion to this that might be helpful in solving this problem. I think I might attack this problem by recursively retrieving the data until I'd reached the root node (parent was null). I might have been inclined to do this outside of the stored procedure initially (repeatedly calling the thing until the retrieved row had the null parent), but the "closure table" solution on the page I referenced here looks like a great solution.

Look here under "Retrieving a Single Path". But better use a nested set approach, it will be much easier to work with a tree. Also I recommend reading "Trees In The Database - Advanced data structures" presentation.

There's also materialized paths to think about. Pretty simple concept that's really database agnostic. Much easier to manage inserts etc as in contrast to nested sets, you don't have to know you're left/right nodes etc before you insert.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions