I have stuck in getting all children's query where parent id greater than the customer id
table test
  id    name    parent
    1   test1   0
    2   test2   1
    3   test3   1
    4   test4   2
    5   test5   2
    6   test6   10
    7   test7   10
    8   test8   6
    9   test9   6
    10  test10  5
    11  test10  7
Currently I am using this recursive query but it shows children till the 10 parent but not able to give children of 6 and 7 and further
SELECT id , parent FROM (SELECT  id , parent from (SELECT * FROM test order by
parent , id) testdata_sorted, (SELECT @pv := '1') initialisation where 
find_in_set(parent , @pv) > 0 and @pv := concat(@pv, ',', id)  ORDER BY 
parent ASC) AS tt
Current Output is ->
id  parent
2   1
3   1
4   2
5   2
10  5
6   10
7   10
I need this Type of output . I need help out in this regard .
id  parent
2   1
3   1
4   2
5   2
10  5
6   10
7   10
8   6
9   6
11  7