ssas mdx查询无法解析歧义

时间:2016-06-13 12:36:37

标签: sql-server-2012 mdx

我正在使用SQL Server Management Studio 2012和数据库Adventures Works。

我写了这个mdx查询:

SELECT
    {
        (
            [Measures].[Reseller Sales Amount]
        )
    } on axis(0),
    {
        (
            [Geography].[Country].Children,
            [Product].[Category].[Accessories]
        )
    },
    {
        (   
            [Geography].[Country].Children,
            [Product].[Category].[Bikes]
        )
    } on axis(1)
from [Adventure Works];

但回复如下:

Executing the query ...
Parser: The statement dialect could not be resolved due to ambiguity.
Execution complete

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

您想要以下内容吗?

SELECT 
  {[Measures].[Reseller Sales Amount]} ON 0
 ,
    [Geography].[Country].Children
  * 
    {
      [Product].[Category].[Accessories]
     ,[Product].[Category].[Bikes]
    } ON 1
FROM [Adventure Works];

或者这个:

SELECT
    {
        (
            [Measures].[Reseller Sales Amount]
        )
    } on axis(0),
    {
        (
            [Geography].[Country].Children,
            [Product].[Category].[Accessories]
        )
    ,

        (   
            [Geography].[Country].Children,
            [Product].[Category].[Bikes]
        )
    } on axis(1)
from [Adventure Works];

错误消息

您获得的方言错误是由于逗号:

SELECT
    {
        (
            [Measures].[Reseller Sales Amount]
        )
    } on axis(0),
    {
        (
            [Geography].[Country].Children,
            [Product].[Category].[Accessories]
        )
    },  //<<<<<EXTRA COMMA HERE
    {
        (   
            [Geography].[Country].Children,
            [Product].[Category].[Bikes]
        )
    } on axis(1)
from [Adventure Works];