Building an MDX Query

Traditional SQL statements alone can be used to query cubes, but they return two-dimensional rowsets. To return a multidimensional dataset, multidimensional expressions (MDX) must be used. The MDX dialect, described in detail in the OLE DB documentation, enables you to query cubes, which contain multidimensional data, and return multidimensional datasets. This topic and its subtopics provide an overview of MDX queries.

As with traditional SQL, the creator of a MDX query must determine the structure of the returned dataset before writing the query. The subtopics that follow describe MDX queries in relation to the datasets expected to be returned from the queries.

Most frequently, creators of MDX queries visualize the returned datasets as multidimensional structures. The creator of a traditional SQL query visualizes and defines the structure of a two-dimensional rowset and writes a query on tables to populate it. In contrast, the creator of an MDX query usually visualizes and defines the structure of a multidimensional dataset and writes a query on a cube to populate it. (MDX queries can also return two-dimensional datasets, however.)

Visualizing multidimensional datasets can be difficult. One method is to limit the presentation to a flattened, two-axis medium, nesting multiple dimensions on a single axis. (This method is used by tabular cube browsers such as the Cube browser included with Microsoft® SQL Server™ OLAP Services.) Nesting produces subheadings. The members of a nested dimension are displayed as subheadings beneath (or beside) the members of the nesting dimension. This visualization method is used in the following topics.

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.