Database Reference
In-Depth Information
result. Nevertheless, the two are quite different. You can write an MDX query that returns a tuple from a single
cell, but you can also return a tuple that is the aggregate value of many cells.
Listing 14-12 shows three queries. The top two queries return one tuple, but the first uses data from a
single cell while the second uses an aggregate from multiple cells. The last query returns two results (tuples) by
aggregating data from multiple cells. Figure 14-8 displays the result of the last query.
Listing 14-12. Queries That Return One or More Tuples
-- This query returns one tuple from a single cell
Select
{
[Measures].[SalesQuantity]
}
On Columns,
{(−− Parentheses are required since we specify a SET of Coordinates
[DimAuthors].[Author].[Cheryl Carson]
,[DimStores].[Store].[Bookbeat]
,[DimTitles].[Title].[But Is It User Friendly?]
,[DimDates].[Year-Qtr-Month-Day].[Date].[Saturday, May 22 1993 12:00 AM]
)}
On Rows
From [CubePubsSales];
-- This query also returns one tuple, but is an aggregate of many cells
Select
{
[Measures].[SalesQuantity]
}
On Columns,
{( −- Parentheses are NOT required since it no longer specifies a SET of Coordinates
[DimStores].[Store].[Bookbeat]
)}
On Rows
From [CubePubsSales];
-- This query returns two tuples, each is an aggregate of many cells
Select
{
[Measures].[SalesQuantity]
}
On Columns,
{−− Braces are required when more than one tuple is returned
([DimStores].[Store].[Bookbeat]) -- Returns one tuple
-- Remember each item in parentheses implicitly includes the other dimensions
,([DimStores].[Store].[News & Brews]) -- Returns another tuple
}
On Rows
From [CubePubsSales];
Important
unless you are using a function, curly braces are required when your query returns more than one tuple.
 
Search WWH ::




Custom Search