Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda