Database Reference
In-Depth Information
Figure 13-1. The results of the basic query
Additionally, it is not easy to understand. Notice that the order dates, titles, and stores show only numeric
key values. Clearly, these reports are not quite user friendly yet, but they will be as soon as you enhance your
query with more information. Let's look at some ways of doing so in the following sections.
Joining Table Data
In Listing 13-3 you can see an example of the basic query having been modified to include the title ID and title
name from the DimTitles table. Note that you need to fully identify any columns that appear in both tables, like
the TitleKey, by prefixing them with the table name. For clarity and code maintenance, we also prefix the TitleID
and TitleName columns.
Listing 13-3. Adding a Table to the Query
SELECT
DWPubsSales.dbo.DimTitles. TitleId
, DWPubsSales.dbo.DimTitles. TitleName
, OrderNumber
, OrderDateKey
, DWPubsSales.dbo.FactSales. TitleKey
 
Search WWH ::




Custom Search