Created
August 11, 2019 12:49
-
-
Save bifacil/d5683cdfe6502d2908827c27551786ab 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
-- Ejemplo 4 | |
COMBINE BY EnglishProductName | |
sales1 AS ( | |
SELECT | |
DimProduct.EnglishProductName AS EnglishProductName, | |
sum(sales.OrderQuantity) AS Quantity2007 | |
FROM FactResellerSales sales | |
INNER JOIN DimProduct USING ProductKey | |
INNER JOIN DimProductSubCategory USING DimProduct(ProductSubcategoryKey) | |
INNER JOIN DimProductCategory USING DimProductSubCategory(ProductCategoryKey) | |
INNER JOIN DimDate USING (OrderDateKey DateKey) | |
WHERE | |
DimDate.CalendarYear=2007 | |
AND DimProductCategory.SpanishProductCategoryName='Bicicleta' | |
AND DimDate.SpanishMonthName='Enero'), | |
sales2 AS ( | |
SELECT | |
DimProduct.EnglishProductName AS EnglishProductName, | |
sum(sales.OrderQuantity) AS Quantity2008 | |
FROM FactResellerSales sales | |
INNER JOIN DimProduct USING ProductKey | |
INNER JOIN DimProductSubCategory USING DimProduct(ProductSubcategoryKey) | |
INNER JOIN DimProductCategory USING DimProductSubCategory(ProductCategoryKey) | |
INNER JOIN DimDate USING (OrderDateKey DateKey) | |
WHERE | |
DimDate.CalendarYear=2008 | |
AND DimProductCategory.SpanishProductCategoryName='Bicicleta' | |
AND DimDate.SpanishMonthName='Enero') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment