COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: V i n c e n t on 14 Nov 2013 04:56:32 AM

Title: Except Join don't work
Post by: V i n c e n t on 14 Nov 2013 04:56:32 AM
Hi,

I need to do an except join (or something similar) between 2 queries.

Query 1 (2 columns) customer for this year

customer revenue
A   500
B   200
C   400
D   500

Query 2 (2 columns) customer for past year
A 1000
B 800
D 900

What i want :
Query 3
C 400

but query 3 is :
A   500
B   200
C   400
D   500

It's probably because except is working with 2 columns from query 1 an 2, and me i want that except work only with first column ?
Can i specify the column between 2 queries , to do the except join ??
If it's not possible, can i use a join with opérator <> between my 2 queries ??

Thanks for your help, and sorry for my english.

Vince.
Title: Re: Except Join don't work
Post by: V i n c e n t on 14 Nov 2013 09:42:43 AM
With Theta-join and appropriate cardinaly, it's possible ????
Title: Re: Except Join don't work
Post by: V i n c e n t on 14 Nov 2013 11:07:22 AM
In SQL :

SELECT <select_list>
FROM TableA A
LEFT JOIN TableB B
ON A.Key=B.Key
WHERE B.Key IS NULL

how to do this in my case with COGNOS ??
Title: Re: Except Join don't work
Post by: CognosSteve on 14 Nov 2013 02:50:08 PM
You can create a left join between the two queries by setting the cardinality the join.  Maybe try that and then do a comparison of data items in the detail filter?
Title: Re: Except Join don't work
Post by: V i n c e n t on 15 Nov 2013 03:21:54 AM
ok it works .

Left join between my 2 queries (1n - 0n) and a détail filter in the final query with B.Key is null.
It's more fast than a except join.

Thanks.

Vince.
Title: Re: Except Join don't work
Post by: CognosSteve on 15 Nov 2013 12:00:53 PM
Glad it worked out for you!