Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / SQL -> MDX / 3 сообщений из 3, страница 1 из 1
09.09.2004, 16:48
    #32688054
vc123
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
SQL -> MDX
Hello,

If I want to express the same as the SQL below in MDX:

Код: plaintext
1.
2.
3.
4.
SELECT STATE,SUM(STORE_SALES)
FROM table
WHERE product='Good Imported Beer' OR year= 1998 
GROUP BY STATE

... in MDX, would this be a reasonable translation:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
WITH
MEMBER Product.mySum AS
'Aggregate (
  Unique ( {
    NonEmptyCrossJoin (
      { Product.[Good Imported Beer] },
      { Time.Year .members}
    )
    +   
    NonEmptyCrossJoin (
      { Product.[Product Name].members },
      { Time.[1998] }
    )
  }), Measures.[Store Sales]
 )'
SELECT
  { Product.mySum } on  0 ,
  Customers.USA.children on  1 
FROM Sales

... or there exists a more elegant expression (in MDX) ?


Also, why this MDX produces an error:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
WITH
MEMBER Measures.mySum AS
'Aggregate (
  Unique ( {
    NonEmptyCrossJoin (
      { Product.[Good Imported Beer] },
      { Time.Year .members}
    )
    +   
    NonEmptyCrossJoin (
      { Product.[Product Name].members },
      { Time.[1998] }
    )
  }), Measures.[Store Sales]
 )'
SELECT
  { Measures.mySum } on  0 ,
  Customers.USA.children on  1 
FROM Sales


Thanks.
...
Рейтинг: 0 / 0
09.09.2004, 22:36
    #32688568
Владимир Штепа
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
SQL -> MDX
IMHO вместо "+" надо ","
...
Рейтинг: 0 / 0
09.09.2004, 23:04
    #32688576
vc123
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
SQL -> MDX
<quote>
IMHO вместо "+" надо ","
</quote>

1. '+' and ',' do the same in this context, namely produce a union of two sets.
The real problem is that Measures.mySum does not work while Product.mySum (see the first version) does. You can easily veri

2. Do you have any thoughts on simplifying the sql->mdx translation ? Is it a general approach with MDX that when you want to describe sets defined by more or less arbitrary predicates, you need to use some combination of CrossJoin and Union ? In SQL, you'd just use predicates in the where clause plus joins when necessary.

Thanks.
...
Рейтинг: 0 / 0
Форумы / OLAP и DWH [игнор отключен] [закрыт для гостей] / SQL -> MDX / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]