Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active February 14, 2023 15:30
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/0b1c8f9ebfd4fd88fa5313cfdd9fac65 to your computer and use it in GitHub Desktop.
Save parzibyte/0b1c8f9ebfd4fd88fa5313cfdd9fac65 to your computer and use it in GitHub Desktop.
SELECT
strftime("%m", ordenes.fecha_solicitud) AS mes,
coalesce(sum(pagos.monto), 0) AS total_vendido
FROM
pagos
INNER JOIN ordenes ON ordenes.id = pagos.id_orden
AND ordenes.fecha_solicitud >= "2023-01-01T00:00:00"
AND ordenes.fecha_solicitud <= "2023-12-31T23:59:59"
GROUP BY
mes
ORDER BY
mes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment