Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

3 different Joins on 2 tables

Hello All,

I am new to QV and am currently in a learning phase. I am posed with a challenge. I have 2 tables like below, I need to know 1) all the records that are common in both the tables. (Which I can do by Using a Join statement. ) 2) Need to know records  from Customer that are unavailable in Segment and 3) records in Segment not available in Customer.

What are the possible ways of doing that?

Customer:

CustIdCustNameSalesAmtDiscount
1A10010
2B20020
3C30030
4D40040
5E50050
6F60060
7G70070
8H80080
9I90090
10J1000100

and

Segment:

CustIdCategorySegment
8RetailMailOrder
9WholesaleTraditional
10RetailB2B
11RetailTraditional
12WholesaleMailOrder
2 Replies
rajni_batra
Specialist
Specialist

You can use outer join with a flag in both the table

Customer:

load

*, 'A' as Table1;

from ABC.qvd;

Outer Join

Segment:

Load

*, 'B' as Table2;

from XYZ.qvd;

load *,

if(isnull(Table1),;Segment Only',

if(isnull(Table2),'Customer Only','Common Ids') as Flag;

resident Customer;

drop table Customer;

hope this helps!!!

Not applicable
Author

Thanks Rajni, that one is really helpful. I am however looking at a solution where I would not require to create another column (like Flag as suggested). I am looking at possible ways at joining the table may be by using a Rename functionality. I am okay if I create 3 views or tables on the dashboard. Wanted to check if this can really be achieved without creating synthetic keys? I appologize if I was/am not  clear about my requirements. But yes the suggestion you provided is really great!