Skip to content

Instantly share code, notes, and snippets.

@bifacil
Created August 11, 2019 13:03
Show Gist options
  • Save bifacil/c0939c026261548ea46dc830f153c25e to your computer and use it in GitHub Desktop.
Save bifacil/c0939c026261548ea46dc830f153c25e to your computer and use it in GitHub Desktop.
SELECT
DimProduct.EnglishProductName AS EnglishProductName,
sum(sales.OrderQuantity) AS Unidades
FROM FactResellerSales sales
INNER JOIN DimProduct ON (sales.ProductKey=DimProduct.ProductKey)
INNER JOIN DimProductSubCategory ON (DimProduct.ProductSubcategoryKey=DimProductSubCategory.ProductSubcategoryKey)
INNER JOIN DimProductCategory ON (DimProductSubCategory.ProductCategoryKey=DimProductCategory.ProductCategoryKey)
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
DimGeography.SpanishCountryRegionName='Alemania'
AND DimProductCategory.SpanishProductCategoryName='Bicicleta'
AND DimDate.CalendarYear=2008
GROUP BY DimProduct.EnglishProductName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment