Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 将MDX查询转换为SQL查询_Sql Server_Tsql_Ssas_Mdx - Fatal编程技术网

Sql server 将MDX查询转换为SQL查询

Sql server 将MDX查询转换为SQL查询,sql-server,tsql,ssas,mdx,Sql Server,Tsql,Ssas,Mdx,我无法将MDX查询转换为SQL查询。谁能帮我找到任何在线转换器,或者转换下面的代码?。我找不到 由于我不熟悉MDX查询,我发现很难转换为SQL查询,并且想知道是否有一些资源可以更轻松地实现这一点 WITH SET [~ROWS_RRE Information_Reporting Period] AS {[RRE Information].[Reporting Period].&[7]} SET [~ROWS_Basic Claim Info_Data Provider] AS

我无法将MDX查询转换为SQL查询。谁能帮我找到任何在线转换器,或者转换下面的代码?。我找不到

由于我不熟悉MDX查询,我发现很难转换为SQL查询,并且想知道是否有一些资源可以更轻松地实现这一点

WITH
SET [~ROWS_RRE Information_Reporting Period] AS
    {[RRE Information].[Reporting Period].&[7]}
SET [~ROWS_Basic Claim Info_Data Provider] AS
    {[Basic Claim Info].[Data Provider].[Data Provider].Members}
SET [~ROWS_Claim Information Detail_RRE ID] AS
    {[Claim Information Detail].[RRE ID].[RRE ID].Members}
SET [~ROWS_Claim Information Detail_RRE Name] AS
    {[Claim Information Detail].[RRE Name].[RRE Name].Members}
SET [~ROWS_RRE Information_Reporting Agent] AS
    {[RRE Information].[Reporting Agent].&[Exam Works], [RRE Information].[Reporting Agent].&[Exam Works/ASSIGNED], [RRE Information].[Reporting Agent].&[Life Care Planning Solutions, LLC], [RRE Information].[Reporting Agent].&[MIRService], [RRE Information].[Reporting Agent].&[PMSI], [RRE Information].[Reporting Agent].&[PMSI Settlement Solutions], [RRE Information].[Reporting Agent].&[UNKNOWN], [RRE Information].[Reporting Agent].&[ISO]}

SELECT
NON EMPTY CrossJoin({[Basic Claim Info].[Claim Status].&[MB Pending], [Basic Claim Info].[Claim Status].&[Deleted], [Basic Claim Info].[Claim Status].&[MB Accepted], [Basic Claim Info].[Claim Status].&[MB Error], [Basic Claim Info].[Claim Status].&[MB Rejected], [Basic Claim Info].[Claim Status].&[MB Submit], [Basic Claim Info].[Claim Status].&[Q Error], [Basic Claim Info].[Claim Status].&[Q Pending], [Basic Claim Info].[Claim Status].&[Q Submitted], [Basic Claim Info].[Claim Status].&[Stopped], [Basic Claim Info].[Claim Status].[All].UNKNOWNMEMBER, [Basic Claim Info].[Claim Status].&[Not Reportable]}, {[Measures].[Claim Count]}) ON COLUMNS,
NON EMPTY ([~ROWS_RRE Information_Reporting Period]  *  [~ROWS_Basic Claim Info_Data Provider]  *  [~ROWS_Claim Information Detail_RRE ID]  *  [~ROWS_Claim Information Detail_RRE Name]  *  [~ROWS_RRE Information_Reporting Agent]) ON ROWS
FROM [MA Reporter NG]]

MDX和SQL是两种不同的语言,SQL不适用于OLAP,MDX不适用于事务数据库

然而,基于这样一个事实,您的多维数据集(SSAS项目)将在事务数据库中有一个底层维度模型(星型模式)。对于每个维度和事实组,多维数据集中的维度和事实通常都有一个基础表。基于这个假设,我已经翻译了您的查询,但是结果只是一个草图,可以帮助您了解该做什么

select a.[Reporting Period],b.[Data Provider],c.[RRE ID],c.[RRE Name],a.[Reporting Agent],b.[Claim Status],count(distinct f.ClaimID)
from 
YourFact f //This will be your fact table having keys of all the dimensions 
inner join 
[RRE Information] a 
on relevantkeys //Join with fact table using this dimensions key
inner join 
[Basic Claim Info] b 
on relevantkeys
inner join 
[Claim Information Detail] c
on relevantkeys
where a.[Reporting Period]=7 and a.[Reporting Agent] in (this list mentioned in ~ROWS_RRE Information_Reporting Agent)
group by 
a.[Reporting Period],b.[Data Provider],c.[RRE ID],c.[RRE Name],a.[Reporting Agent],b.[Claim Status]

MDX和SQL是两种不同的语言,SQL不适用于OLAP,MDX不适用于事务数据库

然而,基于这样一个事实,您的多维数据集(SSAS项目)将在事务数据库中有一个底层维度模型(星型模式)。对于每个维度和事实组,多维数据集中的维度和事实通常都有一个基础表。基于这个假设,我已经翻译了您的查询,但是结果只是一个草图,可以帮助您了解该做什么

select a.[Reporting Period],b.[Data Provider],c.[RRE ID],c.[RRE Name],a.[Reporting Agent],b.[Claim Status],count(distinct f.ClaimID)
from 
YourFact f //This will be your fact table having keys of all the dimensions 
inner join 
[RRE Information] a 
on relevantkeys //Join with fact table using this dimensions key
inner join 
[Basic Claim Info] b 
on relevantkeys
inner join 
[Claim Information Detail] c
on relevantkeys
where a.[Reporting Period]=7 and a.[Reporting Agent] in (this list mentioned in ~ROWS_RRE Information_Reporting Agent)
group by 
a.[Reporting Period],b.[Data Provider],c.[RRE ID],c.[RRE Name],a.[Reporting Agent],b.[Claim Status]

你到底想做什么?MDX用于查询多维SSAS多维数据集,T-SQL用于查询关系表。您永远无法在相同的数据上运行T-SQL查询。您到底想做什么?MDX用于查询多维SSAS多维数据集,T-SQL用于查询关系表。您永远无法在相同的数据上运行T-SQL查询。鉴于我们不知道用于生成多维数据集的表、视图或DSV查询的任何详细信息,这是一个尽可能好的答案。@Greggallowy非常感谢。您对MDX没有信心,还是希望将MDX结果返回到SQL表中?我知道你有你的答案,但我很想理解。这是一个尽可能好的答案,因为我们不知道用于生成多维数据集的表、视图或DSV查询的任何细节。@Greggallowy非常感谢。你对MDX没有信心,还是想将MDX结果返回到SQL表中?我知道你有你的答案,但我很想理解。