Created
August 11, 2019 12:50
-
-
Save bifacil/4c566571a721543f8e8b9186f95abd38 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 5 | |
| COMBINE BY CalendarYear | |
| isales1 AS ( | |
| SELECT | |
| DimDate.CalendarYear AS CalendarYear, | |
| sum(isales.SalesAmount) AS ventasInternet | |
| FROM FactInternetSales isales | |
| INNER JOIN DimDate ON (isales.OrderDateKey=DimDate.DateKey) | |
| INNER JOIN DimCustomer ON (isales.CustomerKey=DimCustomer.CustomerKey) | |
| INNER JOIN DimGeography ON (DimCustomer.GeographyKey=DimGeography.GeographyKey) | |
| WHERE DimGeography.SpanishCountryRegionName='Francia' | |
| GROUP BY DimDate.CalendarYear), | |
| sales1 AS ( | |
| SELECT | |
| DimDate.CalendarYear AS CalendarYear, | |
| sum(sales.SalesAmount) AS ventasReseller | |
| FROM FactResellerSales sales | |
| INNER JOIN DimReseller ON (sales.ResellerKey=DimReseller.ResellerKey) | |
| INNER JOIN DimGeography ON (DimReseller.GeographyKey=DimGeography.GeographyKey) | |
| INNER JOIN DimDate ON (sales.OrderDateKey=DimDate.DateKey) | |
| WHERE DimGeography.SpanishCountryRegionName='Francia' | |
| GROUP BY DimDate.CalendarYear) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment