Database Reference
In-Depth Information
Figure 13-6. The current results with formatted dates
Filtering Results
Many reports filter data so that instead of showing all of the data in a table, you can select specific data to be
made visible. This is done using the SQL WHERE clause, as shown in Listing 13-11.
Listing 13-11. Using a WHERE Clause to Filter the Results
SELECT
[Title] = DT.TitleName
, [TitleId] = DT.TitleId
, [OrderDate] = Convert(varchar(50), [Date], 101)
, SalesQuantity
FROM DWPubsSales.dbo.FactSales AS FS
JOIN DWPubsSales.dbo.DimTitles AS DT
ON FS.TitleKey = DT.TitleKey
JOIN DWPubsSales.dbo.DimDates AS DD
ON FS.OrderDateKey = DD.DateKey
WHERE [TitleId] = 'PS2091'
ORDER BY [Title], [Date]
The results now include only filtered data, as shown in Figure 13-7 .
 
Search WWH ::




Custom Search