Results 1 to 4 of 4

Thread: MDX to SQL

  1. #1
    Join Date
    Jun 2011
    Posts
    11

    Unanswered: MDX to SQL

    Hi all
    May I know how the below query can be converted to SQL query?? I am not able to understand how this can be written in SQL....

    WITH MEMBER Measures.x AS [Date].[Calendar].[Calendar Quarter].Ordinal
    SELECT Measures.x on 0
    FROM [Adventure Works]


    It would be great help if anybody come up with the answer

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    would you kindly please confirm that you are actually using MySQL and not some version of microsoft SQL Server
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2011
    Posts
    11

    MDX to T-SQL

    Hi
    I am using the same version of SQL. Its SQL Server 2008 R2. I have MDX query with ordinal function in calculated measure with case statements. Calculated measure looks like this:
    CASE WHEN [_Sales Count] IS NULL THEN NULL
    WHEN [Date].[Days Calendar].CurrentMember.Level.Ordinal = 0
    AND [Date].[Days Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Long Days Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Long Weeks Fiscal].CurrentMember.Level.Ordinal = 0
    AND [Date].[Months Calendar].CurrentMember.Level.Ordinal = 0
    AND [Date].[Weeks Fiscal].CurrentMember.Level.Ordinal = 0
    THEN
    (
    [Measures].[ResellerSales]
    ,[Date].[Days Calendar].[Calendar Year].&[CY2014].LastSibling

    )
    ELSE
    (
    [Measures].[InternetSales]
    ,[Date].[Days Calendar].[Calendar Year].&[CY2014].LastSibling
    )
    END
    )

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i don't think you fully grasp that MySQL is ~not~ SQL Server

    i will ask the moderators to move this thread to the SQL Server forum
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •