'SQN Query has to return the clients of the user and the children of those clients

This is the query I have so far, which returns the customers of a user. But I need it to also return the children of these clients.

SELECT c.id_client, c.uuid, c.name, c.glpi_entity, c.id_parent 
FROM auth.client AS c
INNER JOIN auth.client_user_data AS cud USING (id_client)
WHERE c.delete_date IS NULL AND cud.delete_date IS NULL AND cud.id_user_data = 4
ORDER BY c.id_parent ASC NULLS FIRST, c.name asc

this query returns:

enter image description here

The tables are:

CLIENT

CLIENT_USER_DATA enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source