I have a table used with the following structure:
I want to get the head of each employee who is identified with the head column.
I have the following nested query to get what I'm looking for, but it does not return the names of the boss
select id_empleado, nombre, apellido,
(select (empleado.nombre ||' '|| empleado.apellido) as jefe_nombres
from empleado where id_empleado = jefe), jefe
from empleado
What I want to obtain is that in the header_name column it appears for example for the employee with id 2 jefe_nombres = Pablo Ramiro Vallejo Zuñiga
How could I solve this?