Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda