I need to get all child and grand child nodes from a specific parent id.
I got the query below from here, but it only ends at the 3rd level, i need it to go further.
i have been on this for about two weeks and in need of support.
SELECT *
FROM TABLENAME
WHERE PARENT = 1
UNION
SELECT *
FROM TABLENAME
WHERE PARENT IN
(SELECT ID FROM TABLENAME WHERE PARENT = 1)
This is a sample of the mysql table
id parent_id name
1 NULL john
2 1 Steve
3 2 sandra
john has a parent id of steve, steve has the parent id of sandra, sandra is the grandchild of john.
i hope you understand what i mean here?...