Skip to content

Instantly share code, notes, and snippets.

@asterion
Created January 15, 2018 12:57
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 asterion/8a9d5e90aec80e37c7e3110efb48ae77 to your computer and use it in GitHub Desktop.
Save asterion/8a9d5e90aec80e37c7e3110efb48ae77 to your computer and use it in GitHub Desktop.
sql group by
SELECT facturas.id, SUM(detalle.cantidad*detalle.valor) FROM facturas, detalle WHERE facturas.id = detalle.factura_id GROUP BY facturas.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment