不知道SQL到MDX

发布于 2025-02-05 03:53:40 字数 202 浏览 2 评论 0原文

我不知道如何在MDX中进行操作,因为我只在SQL中工作,但是如何将此查询从SQL转换为MDX?

select monthname, sum(sales) sales
from table
where dt between 20190315 and 20220204
group by monthname;

感谢您的关注和帮助。

I have no idea how to do it in mdx as I have only worked in sql but how do I translate this query from sql to mdx?

select monthname, sum(sales) sales
from table
where dt between 20190315 and 20220204
group by monthname;

Thank you for your attention and help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蘸点软妹酱 2025-02-12 03:53:40

请注意假设可以来回翻译SQL和MDX。多维数据库的性质意味着适用于两种查询语言的基本概念非常不同。

有时,您当然可以得到类似的答案。就您而言,以下MDX会给您所追求的东西...

SELECT 
{[All Time].[2019].[March]:[All Time].[2022].[February]} ON ROWS,
{[Measures].[Sales] ON COLUMNS
FROM [Cubename]

尽管这将介绍20190301至20220228,这并不是您的SQL查询所做的。

Be careful of assuming that SQL and MDX can be translated back and forth. The nature of multi-dimensional databases means that the basic concepts which apply to the two query languages are very different.

Sometimes you can get similar answers, of course. In your case, the following MDX would give the sort of thing you were after...

SELECT 
{[All Time].[2019].[March]:[All Time].[2022].[February]} ON ROWS,
{[Measures].[Sales] ON COLUMNS
FROM [Cubename]

... although this would look at 20190301 to 20220228 which is not exactly what your SQL query did.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文