MDX中使用成員屬性-資料庫專欄,SQL Server

銀河使者發表於2008-03-08
在許多情況下,一些文字性的內容並非成員的資料,但為了顯示其內容,我們一般定義為成員的屬性,為了在
查詢中使用!比如[customers]維,其性別、住址、電話可能就是成員的屬性,在mdx查詢中,我們既想查詢數
據量,如銷售數量、銷售金額,也想查詢客戶的資訊,如性別、住址、電話等。mdx提供了幾種方法來獲取成員
的屬性。
1)dimension properties
select
    {[measures].members}  on columns,
    {[customers].[all customers].[usa].[ca].[altadena].children}
     dimension properties [customers].[name].gender,[customers].[name].address 
    on rows
from sales
可以查詢客戶的性別和地址屬性。
備註:在mdx例子應用中查詢語法正確,資料無法顯示,是否要通過adomd等才能正確獲取??
2)properties 函式
with
   member [measures].[gender] as
   [customers].currentmember.properties("gender")
   member [measures].[address] as
   [customers].currentmember.properties("address")
select
    { [measures].[gender], [measures].[address],[measures].members}  on columns,
    {[customers].[all customers].[usa].[ca].[altadena].children}    on rows
from sales
在mdx顯示客戶性別、地址以及銷售金額等資訊。
備註:在mdx例子應用中資料正常顯示。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12921506/viewspace-201761/,如需轉載,請註明出處,否則將追究法律責任。

相關文章