dbTalk Databases Forums  

Where clause of MDX

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Where clause of MDX in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
asim73
 
Posts: n/a

Default Where clause of MDX - 09-02-2003 , 09:59 AM







Hi,



According to my knowlege the WHERE clause of MDX Queries

expects a touple in front of it.



The .item(0) function returns a touple from a set according to

definition. (there is another variation of .item that returns a member

from a tuple).



There ORDER() function returns a set.



My question is when i execute the following query,



SELECT TIME.YEAR.MEMBERS ON COLUMNS FROM SALES

WHERE ORDER(market.region.members, measures.sales).item(0)



it gives the error :-



Unable to open cellset

Syntax error, expecting end of statement

but found extra text, near: '.item(0)'



But when I execute the following , it executes it succesfuly. (I just

added open bracket before ORDER and another close bracket after

..item.



SELECT TIME.YEAR.MEMBERS ON COLUMNS FROM SALES

WHERE (ORDER(market.region.members, measures.sales).item(0))





I know that when I explicitly write a single member on axis, i have

to convert it into set by using { } brackets. This means by default

it assumes it a tuple. Then why didnt it assumed it a tuple in the where

clause.



Thanks



Asim Naveed


--
Posted via http://dbforums.com

Reply With Quote
  #2  
Old   
Francesco De Chirico
 
Posts: n/a

Default Re: Where clause of MDX - 09-03-2003 , 11:23 AM






Hi Asim,
I've tried this query on Foodmart 2000:

SELECT
{[Time].[Year].Members} ON COLUMNS
FROM
[Sales]
where
(Order([Store].[Store State].Members,[Measures].[Unit Sales]).Item(0))

and it works fine!!!

Francesco De Chirico



Reply With Quote
  #3  
Old   
asim73
 
Posts: n/a

Default Re: Where clause of MDX - 09-03-2003 , 01:28 PM




Yes it executes successfuly, but my question is

why we need to add open and close bracktes. According to syntax

it should run without these brackets



Thanks


--
Posted via http://dbforums.com

Reply With Quote
  #4  
Old   
Francesco De Chirico
 
Posts: n/a

Default Re: Where clause of MDX - 09-04-2003 , 07:55 AM



Good, good question!!!
I think it's a bug!!
It doesn't work even if you use a StringExpression instead of the IndexValue
and
also if you use StrToTuple() (without the additional brackets).

Francesco De Chirico



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.