MDAC 2.5 SDK - OLE DB Programmer's Reference
Chapter 26: Mapping MDX to SQL Statements


 

Getting Cell Values

The query for getting the cell values is as follows:

SELECT Value, NewRank AS Rank
FROM
   (SELECT Value
   FROM 
      (Fact AS F JOIN Cprime AS C ON 
         (   C.[Product.[All]] = F.[Product.[All]]
         AND C.ProdLine = F.ProdLine
         AND C.Product = F.Product
         AND C.[Geography.[All]] = F.[Geography.[All]]
         AND C.Country = F.Country
         AND C.State = F.State
         AND C.City = F.City
         AND F.Zipcode = ALL()
         )
      JOIN Rprime AS R ON
         (   R.[Time.[All]] = F.[Time.[All]]
         AND R.Year)  = F.Year
         AND R.Quarter = F.Quarter
         AND R.Month = F.Month
         AND F.Day = ALL()
         )
      )
   WHERE F.Measures = "Sales")
   RANK ROWS AS newrank RANKORDER BY Rank1, Rank2
ORDER BY Rank