Union (MDX)
Returns a set that is generated by the union of two sets, optionally retaining duplicate members.
Syntax
Standard syntax
Union(Set_Expression1, Set_Expression2 [,...n][, ALL])
Alternate syntax 1
Set_Expression1 + Set_Expression2 [+...n]
Alternate syntax 2
{Set_Expression1 , Set_Expression2 [,...n]}
Arguments
- Set Expression 1
A valid Multidimensional Expressions (MDX) expression that returns a set.
- Set Expression 2
A valid Multidimensional Expressions (MDX) expression that returns a set.
Remarks
This function returns the union of two or more specified sets. With the standard syntax and with alternate syntax 1, duplicates are eliminated by default. With the standard syntax, using the ALL flag keeps duplicates in the joined set. Duplicates are deleted from the tail of the set. With alternate syntax 2, duplicates are always retained.
Examples
The following examples demonstrate the behavior of the Union function using each syntax.
Standard syntax, duplicates eliminated
SELECT Union
([Date].[Calendar Year].children
, {[Date].[Calendar Year].[CY 2002]}
, {[Date].[Calendar Year].[CY 2003]}
) ON 0
FROM [Adventure Works]
Standard syntax, duplicates retained
SELECT Union
([Date].[Calendar Year].children
, {[Date].[Calendar Year].[CY 2002]}
, {[Date].[Calendar Year].[CY 2003]}
, ALL
) ON 0
FROM [Adventure Works]
Alternate syntax 1, duplicates eliminated
SELECT
[Date].[Calendar Year].children
+ {[Date].[Calendar Year].[CY 2002]}
+ {[Date].[Calendar Year].[CY 2003]} ON 0
FROM [Adventure Works]
Alternate syntax 2, duplicates retained
SELECT
{[Date].[Calendar Year].children
, [Date].[Calendar Year].[CY 2002]
, [Date].[Calendar Year].[CY 2003]} ON 0
FROM [Adventure Works]
See Also
Reference
+ (Union) (MDX)
MDX Function Reference (MDX)
Help and Information
Getting SQL Server 2005 Assistance
Change History
Release | History |
---|---|
17 July 2006 |
|