Can I do a function which gives me all the children of a particular ID (and their children)?
So, for example in the attached image, if I wanted to get all the children (and their children) for Vodka(5) I should get:
Absolut Vodka(24) > Stolichnaya Red(39) > Level Vodka(36) > 42 Below Vodka Pure(35)
which all have a parentID of 5, but also I want to get Absolut Kurant which has a parentID of 24...ie the chain is:
Vodka(5) > Absolut Vodka(24) > Absolut Kurant(28)
and the complete result of the query would be:
Absolut Vodka,Absolut Kurant,Stolichnaya Red,Level Vodka,42 Below Vodka Pure
To build the tree you see in the image I use functions in code, but for this I really need to be able to do it in mySQL.
Can I do these kind of functions? ANy ideas would be appreciated.