DeepSee MDX Reference
SELECT Statement
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Executes a query and returns the results. This section describes the basic syntax.
Syntax and Details
SELECT set_expression ON 0, set_expression ON 1 FROM cube_name
Where:
If you omit the ON clause, MDX returns the count of records in the cube. If this is a compound cube, this is the sum of the counts of all cubes combined in that compound cube.
For any given cell of the results, to determine the value to use, DeepSee finds the intersection of the member used for the column and the member (if any used) for the row:
Example
The following simple example shows patient counts by ZIP code.
SELECT MEASURES.[%COUNT] ON 0, homed.zip.MEMBERS ON 1 FROM patients
                             Patient Count
1 32006                               2,272
2 32007                               1,111
3 34577                               3,399
4 36711                               1,069
5 38928                               2,149
In the following example, the patients2 cube does not include the Home Zip level. Instead, this cube has a relationship called Home City that points to another cube, called cities. The query uses this relationship:
SELECT MEASURES.[%COUNT] ON 0, city.cityd.city.members ON 1 FROM patients2
 
                             Patient Count
1 Cedar Falls                        1,097
2 Centerville                        1,136
3 Cypress                            1,124
4 Elm Heights                        1,089
5 Juniper                            1,133
6 Magnolia                           1,063
7 Pine                               1,124
8 Redwood                            1,083
9 Spruce                             1,151
See Also