0

This question already has an answer here:

I am facing problem to show a particular parent child value and under all child value as a relationship. I have created single table tree and three column id, child and parent.

I created a tree relationship but I don't understand how to fetch a particular parent child and his child and his child value for tree. Can you help me?

marked as duplicate by RolandoMySQLDBA mysql Nov 6 '14 at 20:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    do you want to fetch a value and all his descendants? Can you add the content of a table for a simple tree? Do you have any constraints on your table? what mysql version are you using? Can you show the statements that adds/deletes a node to/of the tree? You are writing about ships but I think you want to write about relationships. – miracle173 Nov 6 '14 at 8:13
0

By the way the same question has been already asked/answered and I would recommand you reading the article of the answer.

The article propose another solution which is less expensive to list parent/children : "The Nested Set Model" method which use these columns : id, left, right. You will have to manage by yourself (or by your application) the left/right value.

Not the answer you're looking for? Browse other questions tagged or ask your own question.