开发者

Cursor in a MDX expression?

开发者 https://www.devze.com 2023-03-06 12:47 出处:网络
I have a TABLE A( Type INT, Value INT ) Now I want to calculate the difference between the Value of each two subsequent lines of the same Type.

I have a

TABLE A(
 Type INT,
 Value INT
)

Now I want to calculate the difference between the Value of each two subsequent lines of the same Type.

In SQL I'd use a Cursor and make the calculations myself. Is there a more efficient of doing this using a MDX expression (either with a script command or in a calculat开发者_运维百科ed member)?


This is only going to work on an SQL server that integrates an MDX engine (not the 'classical' other way around). The only one I know where it might work is Oracle, is this your system?


I don't think MDX is the answer. I'd JOIN the table to itself to create pairs of adjacent rows, and get the difference that way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号