Database Reference
In-Depth Information
, OrderNumber
, OrderDateKey
, StoreKey
, SalesQuantity
FROM DWPubsSales.dbo.FactSales AS FS
INNER JOIN DWPubsSales.dbo.DimTitles AS DT
ON FS.TitleKey = DT.TitleKey
ORDER BY [Title], [OrderDateKey]
Figure 13-3 shows the results of this query. It includes the reordered columns and rows, as well as the aliased
column names.
Figure 13-3. Using column alisas and ORDER BY for our results
Currently our results include the OrderDateKey, but we do not have an understandable date format. This
is because the date data is in the DimDates table, and we have not yet included that in our query. We do so in
Listing 13-7.
Listing 13-7. Adding Data from the DimDates Table
SELECT
[Title] = DT.TitleName
, DT.TitleId
, [Internal Data Warehouse Id] = FS.TitleKey
, OrderNumber
, OrderDateKey
, [OrderDate] = DD.[Date]
, StoreKey
, SalesQuantity
 
Search WWH ::




Custom Search