Microsoft® SQL Server™ OLAP Services supports the following subset of the SQL SELECT command syntax. For a description of other supported SQL statements as well as related multidimensional expressions (MDX) syntax, see PivotTable Service.
SELECT [<options_clause>] <select_list> FROM <from_clause> [WHERE <where_clause>] [GROUP BY <groupby_clause>]
<options_clause> ::= <empty_clause> | DISTINCT
<select_list> ::= <scalar_exp_commalist> | ASTERISK
<scalar_exp_commalist> ::= <scalar_expression> [, <scalar_expression> [, <scalar_expression> […]]]
<scalar_expression> ::= <column_ref>
| <aggregate>
| (<column_ref>) AS IDENTIFIER
<aggregate> ::= <aggregate_func> (<column_ref>)
Note In the preceding line, <column_ref> must be a measure name. The <aggregate_func> must agree with the Aggregate Function property of the measure.
<aggregate_func> ::= COUNT | MIN | MAX| SUM
Note <select_list> may only include levels or measures. If measures are specified, you must also specify <aggregate>.
<from_clause> ::= cube_name
<where_clause> ::= empty_clause | <search_condition>
<groupby_clause> ::= <column_ref_commalist>
<column_ref_commalist> ::= (<column_ref>) [, (<column_ref>) [, (<column_ref>) […]]]
<search_condition> ::= <empty_clause>
| <search_condition> AND <search_condition>
| <search_condition> OR <search_condition>
| (<search_condition>)
| <comparison_predicate>
<comparison_predicate> ::= (<column_ref>) = VALUE | VALUE = (<column_ref>)
Note In the preceding line, <column_ref> must be a valid level name.