COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: everlearner on 29 Oct 2012 08:26:21 AM

Title: can i create join on 2 union queries?
Post by: everlearner on 29 Oct 2012 08:26:21 AM
Hi gurus,

i have 2 union queries, can i join those two?
if yes what are the rules i have to follow?
thanks in adv
Title: Re: can i create join on 2 union queries?
Post by: tjohnson3050 on 29 Oct 2012 12:31:18 PM
I assume you mean you have two queries, each of which are the result of unioning other queries together?

All you need is to have fields in each of those queries with common data types to join on.
Title: Re: can i create join on 2 union queries?
Post by: everlearner on 30 Oct 2012 02:14:37 AM
yes john,

the two queries are results of union  other queries.
here in the detail... q1,q2,...q6
q3 is union of q1 & q2
q6 is union of q4 & q5

now my requirement is to be join q3 & q6.
i have created the join between q3,q6 by sNum.

after the join when i validate the report am getting the following errors...

1)UDA-SQL-0353 An error was detected while processing the SQL request.
2)RQP-DEF-0177 An error occurred while performing operation 'sqlPrepareWithOptions' status='-16'.

please do needful to resolve this problem..
thanks in adv
Title: Re: can i create join on 2 union queries?
Post by: mtirpude on 30 Oct 2012 06:58:31 AM
Hi,

You can join the two queries. There is no issue in joining the unioned queries. Lets say your query is Q7 (joined of q3 and q6)
Need below inputs -
1. Your report is not validating and throwing error. Did you checked tabular data of Q7? Is tabular data coming back for query Q7.
2. If Q7 tabular data is throwing errors, please check query q3 is also returning tabular data. If it is returning, then check if query q6 is returning tabular data.
3. As per my thoughts, this error might be occuring in either query q3 and q6. If the error occuring in q3, then check that q1 and q2 should have query items in same order (for unioning queries, it is compulsory that all the query items should be in same order). Same with q4 and q5.

Regards,
Manish Tirpude | 919673990644