If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Query from Another Query (Relational)

Started by gosoccer, 16 Jun 2017 10:58:34 AM

Previous topic - Next topic

gosoccer

Hi, :) :)

I need to create a list from a Query1. I need the Query 1 to be based on Query2 and nothing else.
I have a unique ID, CAR_ID that i can use between these two queries. I'm not sure if I should Intersect or Union
between these two Queries? Like have a filter in Query2 that would filter out only the filters from Query1
QUERY1.[CAR_ID] in (Query2.CAR_ID])

Please help if you can.

Thx 8)

Lynn

Quote from: gosoccer on 16 Jun 2017 10:58:34 AM
Hi, :) :)

I need to create a list from a Query1. I need the Query 1 to be based on Query2 and nothing else.
I have a unique ID, CAR_ID that i can use between these two queries. I'm not sure if I should Intersect or Union
between these two Queries? Like have a filter in Query2 that would filter out only the filters from Query1
QUERY1.[CAR_ID] in (Query2.CAR_ID])

Please help if you can.

Thx 8)

Have you tried a query reference?

http://www.cognoise.com/index.php?topic=12032.0


gosoccer

Hi Lynn,  :) :)
Thanks for the update.

First Query only gets certain Rows based on a specific filter.

The second Query gets the same rows from Query 1 but based on their latest Status that we have in our history table.

So, I have the first Query getting the data set and second Query retrieving the data set by having a filter as following,
[Query2].[REC_ID] in (Query1].REC_ID])

It seems to be working but let me about any suggestions you may have.

Lynn

I think I misunderstood the original post so disregard my earlier suggestion.

psrpsrpsr

If you post examples of your data and the desired output that will help with solving the problem. I like http://www.tablesgenerator.com/ for mocking up data tables.

BigChris

I'm not sure if this is what you're looking for, but I would probably create a join between Query1 and Query2 and feed the results into Query3. The join between Query1 and Query2 would be on REC_ID