@brenda grossnickle I believe Robert is explaining this behaviour in reporting:
you can use data items from Query 2 in Query 1. Technically you don't need to link the queries as shown you can just use the syntax [Query2].[data item] in query 1. You have to be careful in doing this though as you have to understand the implications of the SQL you are generating.
Filters, such as an IN are usually no cause for concern. But using objects from Q2 in Q1 as data items, as well as other data items in Q1 can result in unintended sql.
------------------------------
Marc Reed
------------------------------
Original Message:
Sent: Mon October 14, 2024 07:27 AM
From: brenda grossnickle
Subject: SQL Exists within a Report
@Robert Dostal - i am intrigued by your two suggestions but do not really understand either one. if you have time, can you mock up a simple example?
------------------------------
brenda grossnickle
BI Programmer Analyst
FIS
Original Message:
Sent: Fri October 11, 2024 10:26 AM
From: Robert Dostal
Subject: SQL Exists within a Report
Hi Mark,
you can link qeueries in report studio. Just create two queries and place the needed data items in them and then drag one next to the other:
You can now use the data from Querey1 in the filter area in Query2:
Another way is to use {}. Everything between them will be pushed directly to the database system without any interpretation from Cognos. Yo oyu can place any valid manual written SQL in there. Give it a try.
------------------------------
Robert Dostal
Team Leader BI
GEMÜ Gebr. Müller Apparatebau GmbH & Co. KG
Ingelfingen
Original Message:
Sent: Thu October 10, 2024 11:53 AM
From: Marc Reed
Subject: SQL Exists within a Report
Hi all,
I know I can do a filter such as
[Order Method Code] in ( [Query2].[Order Method Code] )
within a report.
Traditionally in SQL such a filter would be written as an EXISTS statement as it usually faster than an IN statement when the query referenced within the IN is a large result set.
Is there anyway of writing a SQL EXISTS within a CA report query?
Thanks
------------------------------
Marc Reed
------------------------------