I have the following model:
Table user: id, name, direct_manager_id Table customer: id, name, managed_by_id
i.e. users can have another user as their direct manager, Customers can be managed by a user.
My requirement is to create a simple select query that will retrieve all the customers that are managed by a specific user. moreover I would like that query to retrieve all the customers that are managed by users that their direct manager is that same user (1 level deep of direct management). and to retrieve all the customers that their direct manager is manged by a user that the direct manager of him is the targeted user (2nd level deep of direct management).... (to the nth level deep)
Aucun commentaire:
Enregistrer un commentaire