Skip to content

Instantly share code, notes, and snippets.

@bifacil
Created August 11, 2019 13:05
Show Gist options
  • Save bifacil/fc5f3bc3c791a1f4048d3814faa3d80f to your computer and use it in GitHub Desktop.
Save bifacil/fc5f3bc3c791a1f4048d3814faa3d80f to your computer and use it in GitHub Desktop.
SELECT
DimGeography.SpanishCountryRegionName AS SpanishCountryRegionName,
sum(sales.OrderQuantity) AS Unidades
FROM FactResellerSales sales
INNER JOIN DimDate ON (sales.OrderDateKey=DimDate.DateKey)
INNER JOIN DimReseller ON (sales.ResellerKey=DimReseller.ResellerKey)
INNER JOIN DimGeography ON (DimReseller.GeographyKey=DimGeography.GeographyKey)
WHERE DimDate.CalendarYear=2008
GROUP BY DimGeography.SpanishCountryRegionName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment