dbTalk Databases Forums  

Can I make a union of queries?

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


Discuss Can I make a union of queries? in the microsoft.public.sqlserver.olap forum.



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

Default Can I make a union of queries? - 09-28-2004 , 01:45 PM






I was wondering if there was a way to make a union of queries?


select {[RunningTotalSubs], [test1]} on Columns, CrossJoin([Age Group].[All
Age Group].children, TopCount( { [DMA].children}, 5, ([RunningTotalSubs])))
on Rows from [consumer_analysis] where [Zone Id].&[14]

result:
AGE RunningTotalSubs
20-30 1000
30-40 2000
40-50 1000

select {[RunningTotalSubs], [test1]} on Columns, CrossJoin([Gender].[All
Gender].children, TopCount( { [DMA].children}, 5, ([RunningTotalSubs]))) on
Rows from [consumer_analysis] where [Zone Id].&[14]

result:
GENDER RunningTotalSubs
M 1000
F 2000
U 1000


Is there a way to combine the queries so I can get a result set like:

AGE-GENDER Total
20-30 1000
30-40 2000
40-50 1000
M 1000
F 2000
U 1000




Reply With Quote
  #2  
Old   
Cindy Lee
 
Posts: n/a

Default Re: Can I make a union of queries? - 09-28-2004 , 01:58 PM






oops, ignor the test1
query should be like this:

select {[RunningTotalSubs]} on Columns, CrossJoin({[Age Group].[All
Age Group].children}, TopCount( { [DMA].children}, 5,
([RunningTotalSubs])))
on Rows from [consumer_analysis] where [Zone Id].&[14]


"Cindy Lee" <cindylee (AT) hotmail (DOT) com> wrote

Quote:
I was wondering if there was a way to make a union of queries?


select {[RunningTotalSubs], [test1]} on Columns, CrossJoin([Age
Group].[All
Age Group].children, TopCount( { [DMA].children}, 5,
([RunningTotalSubs])))
on Rows from [consumer_analysis] where [Zone Id].&[14]

result:
AGE RunningTotalSubs
20-30 1000
30-40 2000
40-50 1000

select {[RunningTotalSubs], [test1]} on Columns, CrossJoin([Gender].[All
Gender].children, TopCount( { [DMA].children}, 5, ([RunningTotalSubs])))
on
Rows from [consumer_analysis] where [Zone Id].&[14]

result:
GENDER RunningTotalSubs
M 1000
F 2000
U 1000


Is there a way to combine the queries so I can get a result set like:

AGE-GENDER Total
20-30 1000
30-40 2000
40-50 1000
M 1000
F 2000
U 1000






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.