COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Jeka on 08 Jun 2009 12:25:36 PM

Title: UNION???
Post by: Jeka on 08 Jun 2009 12:25:36 PM
Hi Guys,

Working with a relation model.
Using same dimensions for both queries, except of Date dimension.
1st query uses Transaction Date. with 3 measures + 5 dimensions. It has Date prompt and Location Prompt.
2nd query uses Snapshot date with 5 different measures, same dimensions. It also has Date prompt and Location Prompt.

How can I make both queries to be in the same list table.

I know i can do UNION…. but 2 queries have different number of data items.

Is there any other option....????

Thank you for your input. 
Title: Re: UNION???
Post by: blom0344 on 08 Jun 2009 03:57:28 PM
Simply use dummy values (for instance zero: 0) where you need them. SQL is very valid with assigning constants in the select :



SELECT DIM1,DIM2, SUM(MEASURE1) AS M1, SUM(MEASURE2) AS M2
FROM TABLE1
GROUP BY DIM1,DIM2
UNION
SELECT DIM1,DIM2, 0,0
FROM TABLE2


is perfectly acceptable