Database Reference
In-Depth Information
Now the results include only data with a prefix of PS , as shown in Figure 13-9 .
Figure 13-9. Results filtered with a wildcard search
he LIKE operator is certainly useful, and you will find plenty of opportunities to use it. Here are two other
operators we have found useful over the years. The first is the IN operator. It filters results based on a list of
possible choices. When a row has data that matches one of the listed items, the row is returned as part of the
result set. Listing 13-14 shows an example of the IN operator being used.
Listing 13-14. Using the IN Operator
SELECT
DP.PublisherName
, [Title] = DT.TitleName
, [TitleId] = DT.TitleId
, [OrderDate] = CONVERT(varchar(50), [Date], 101)
, SalesQuantity
FROM DWPubsSales.dbo.FactSales AS FS
INNER JOIN DWPubsSales.dbo.DimTitles AS DT
ON FS.TitleKey = DT.TitleKey
INNER JOIN DWPubsSales.dbo.DimDates AS DD
ON FS.OrderDateKey = DD.DateKey
INNER JOIN DWPubsSales.dbo.DimPublishers AS DP
ON DT.PublisherKey = DP.PublisherKey
WHERE [Date] IN ( '09/13/1994' , '05/29/1993' )
ORDER BY DP.PublisherName, [Title], [OrderDate]
 
Search WWH ::




Custom Search