In have an SQL table like:
id, parentid, name
1 0 Root
2 1 label 1
3 2 label 1.1
4 3 label 1.1.1
5 1 label 2
6 5 label 2.1
7 6 label 2.1.1
Now I want to find all child by id 2/3/5 etc.. How do I do this?
Suppose
table1is your table name and@inputcontains the input valueThis can be done if the name field has format like in your example.
For recursive SQL refer this way: