CatID parID catName
1 -1 A
2 1 B
3 2 C
4 3 D
I want to write a query which returns the parent child relationship in string format.
In the above table the catName has parentId -1, which means it has got no parent. B has parentID 1, which means that A is its parent.
So finaly the string is like this
A=>B=>c=>D
This is the way I want to generate a query.
I’ll pass CatID, and it will traverse until it gets a -1.
SE-Data