Created
August 11, 2019 13:02
-
-
Save bifacil/dcf84873b76970609993cb378ed77491 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
DimProduct.EnglishProductName AS Producto, | |
sum(sales.OrderQuantity) AS Unidades, | |
sum(sales.SalesAmount) AS Importe, | |
sum(sales.SalesAmount)/sum(sales.OrderQuantity) AS [Precio Medio] | |
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) | |
WHERE | |
DimProductCategory.SpanishProductCategoryName='Bicicleta' | |
AND DimDate.SpanishMonthName='Enero' | |
AND DimDate.CalendarYear=2008 | |
GROUP BY DimProduct.EnglishProductName | |
ORDER BY [Precio Medio] DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment