Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
How to list managed users?

I have a database that has a users table with two different columns, "users_id" and "users_manager". Each user has a manager above him.

Here's the deal: I need to list all users related to a manager, but in a way similar to a family tree — meaning that I have to list the main manager and each user below him, and if the user below him also managers other users, I have to list them too.

Here's an example:

• The user "2" manages the user "7". "7" manages users "10" and "12". "10" manages users "15" and "16"; "12" manages users "17" and "18". I need a list that includes all these users above when I'm refering to user "2", including "2" itself.

usersManagedBy2 = [2, 7, 10, 12, 15, 16, 17, 18]

I can't figure a way to achieve that using JavaScript, NodeJS and MySQL. Can someone help me?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!