2015-02-11 58 views

回答

0

爲此,請使用Type SQL List和「All」作爲值(注意區分大小寫)。示例查詢是:

SELECT DISTINCT 'All' AS VAL, 'ALL TERRITORIES' AS DESC FROM customer_w_ter 
UNION ALL 
select DISTINCT TERRITORY, TERRITORY from customer_w_ter 
+0

而在MDX您可以通過與self_and_before標籤做的事情相當於做的所有成員,並且希望集之間或使用後代工會功能的下一級在一起。 – nsousa 2015-02-12 09:54:53

0

@邁克爾克里斯托弗 我用下面PostgreSQL的查詢來獲取數據。
select 'All' as accountclass ,status ,count(guaccountid) as count from sms_accountinformation group by status union select distinct accountclass ,status ,count(guaccountid)as count from sms_accountinformation group by accountclass,status order by accountclass,status

有沒有替代品沒有硬編碼?
數據集看起來如下
"All";"Active";2288 "All";"PD";257 "All";"TD";777 "Customer";"Active";2275 "Customer";"PD";152 "Customer";"TD";359 "Dealer";"Active";13 "Dealer";"PD";105 "Dealer";"TD";418

0

你需要在你的查詢做的是與「ALL」數據添加一個額外的行。在編寫ALL部分的查詢時,不需要執行group by子句。檢查下面的代碼(希望這將是更清晰)

select distinct 
accountclass, 
status, 
count(guaccountid)as count 
from sms_accountinformation 
group by accountclass,status order by accountclass,status 

union 

select 'ALL' as accountclass, 
'ALL' as status, 
'ALL' as count 
from sms_accountinformation 

這會爲你抓取與「ALL」的結果集爲一個更行,你可以在你的過濾器列表中使用它。

希望它能幫助:)

相關問題