Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active March 13, 2020 20:01
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/6fc6ba16744e8c0b3c6f49a04b382d67 to your computer and use it in GitHub Desktop.
Save parzibyte/6fc6ba16744e8c0b3c6f49a04b382d67 to your computer and use it in GitHub Desktop.
rows, err := bd.Raw(`select sum(operaciones_de_cortes.precio * bultos_de_cortes.piezas) as ganancia,
empleados.id
from bihorarios
inner join bultos_de_empleados
on bihorarios.id_bulto_de_empleado = bultos_de_empleados.id
inner join operaciones_de_cortes
on operaciones_de_cortes.id = bultos_de_empleados.id_operacion_de_corte
inner join empleados
on bultos_de_empleados.id_empleado = empleados.id
inner join bultos_de_cortes
on bultos_de_cortes.id = bultos_de_empleados.id_bulto_de_corte
where bultos_de_empleados.fecha_terminacion != ''
and bultos_de_empleados.fecha_terminacion >= ?
and bultos_de_empleados.fecha_terminacion <= ?
group by empleados.id;`, fechaInicio, fechaFin).
Rows()
if err != nil {
return empleados, err
}
defer rows.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment