Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created January 17, 2022 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/ee2dedc01e2004c98b0e58526ca6bf57 to your computer and use it in GitHub Desktop.
Save parzibyte/ee2dedc01e2004c98b0e58526ca6bf57 to your computer and use it in GitHub Desktop.
select e.nombre, e.apellido_paterno, e.apellido_materno, e.sueldo,
(
select coalesce(json_agg(bonos), '[]')
from (
select cantidad,
concepto
from bonos_empleado_nomina
where id_nomina = 3
and id_empleado = e.id
) bonos
) bonos
from empleados e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment