Need help to query all users under parent id

The below post provides an algorithm to parse an adjacency list using the application language to filter children. Use the primary key of the user for the first argument of the convertAdjacencyListToTree function instead of of the root id specified in the post (null). That should get you a series of nested forming a tree from the specified user. However, you will need to select the entire tree in SQL and let the application language handle filtering. Therefore, if there is a lot of data loading it all into memory and filtering as shown might not be the *best route.