Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select from subquery 1

Status
Not open for further replies.

craig322

MIS
Apr 19, 2001
108
US
Does anyone know how to do use a subquery in cognos without actually typing in the sql.

For example if I wanted a report to show me the output of this sql (without actually typing the sql).

The reason I don't want to enter the sql is that I still want the flexibility of using prompts.

Here is a simplified example of what I mean.

SELECT field_a
FROM table_a
WHERE field_b = (SELECT MAX(field_c)
FROM table_c)

Thanks

Craig
 
Craig,

The way to do this is to create two queries within Impromptu, then apply a filter...... when the filter is being applied select field_b in 'Dataset' this will allow you to locate your sub-query (IMR).

I hope this helps ???

Paul
 
I understand what you are saying to do, but I can't see a way to point to another query using the Filter tab.

Can you give me a little more help.

 
Firstly write the sub query in Impromptu (SELECT MAX(field_c)FROM table_c).

Then construct your main query, apply a filter, select the column you wish to filter, in this case field_b. Select IN and then select DATASET, a dialog box then appears, in this window, find your sub query, and in the relevant box, select the column on whcih you wish to filter, in this case, MAX(field_c).

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top