Skip to content

Instantly share code, notes, and snippets.

@bifacil
Created September 30, 2016 13:01
Show Gist options
  • Save bifacil/6728fb4799c8743775e449dbafd83c59 to your computer and use it in GitHub Desktop.
Save bifacil/6728fb4799c8743775e449dbafd83c59 to your computer and use it in GitHub Desktop.
SELECT
LB_TIENDAS.POBLACION AS #Poblacion,
LB_TIENDAS.NOMBRE AS #Tienda,
LB_TIEMPO.FECHA AS Fecha,
sum(LB_VENTAS.UNIDADES) AS Unidades
FROM LB_VENTAS
INNER JOIN LB_TIENDAS ON (LB_VENTAS.ID_TIENDA=LB_TIENDAS.ID_TIENDA)
INNER JOIN LB_TIEMPO ON (LB_VENTAS.FECHA=LB_TIEMPO.FECHA)
WHERE
LB_TIEMPO.ANYO='2013'
AND LB_TIENDAS.POBLACION='BARCELONA'
GROUP BY
LB_TIENDAS.POBLACION,
LB_TIENDAS.NOMBRE,
LB_TIEMPO.FECHA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment