COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: mp3909 on 11 Feb 2021 12:52:32 PM

Title: in and where clause
Post by: mp3909 on 11 Feb 2021 12:52:32 PM
Hi All,

How do I replicate this sql logic in my cognos report?

sql clause --> and a.customerNumber in (select c.customerNumber from c where c.accountNumber=4) ???

I tried adding this in the detail filters of the query:

[a].[customerNumber] in ([c].[customerNumber]) where [c].[accountNumber]=4 but it's complaining.


Any ideas?

Thanks
Title: Re: in and where clause
Post by: Wangd on 11 Feb 2021 01:16:42 PM
You will need to use SQL for the Query. 
See this: https://www.ibm.com/support/knowledgecenter/en/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ug_cr_rptstd.doc/t_cr_rptstd_wrkdat_build_report_using_your_own_sql_mdx.html
Title: Re: in and where clause
Post by: dougp on 11 Feb 2021 01:46:14 PM
How is that different from...
from a
  inner join c on c.customerNumber = a.customerNumber
              and c.accountNumber = 4

...?

Create two queries and join them.