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

Common values in two fields in two tables

Hi

I have two tables

Table1
ID , Email
1, abc@
2, def@
3, ghi@

Table2
ID , Email
2,def@
3,ghi@
4,jkl@

I want new field which contains the emails which are common in both the tables

Thanks in Advance

Labels (2)
1 Reply
sk88024
Contributor III
Contributor III

Hope this help!

Script - 

Table1:
LOAD * INLINE [
ID , Email
1, abc@
2, def@
3, ghi@
];

Table2:
LOAD * INLINE [
Id, EMAIL
2,def@
3,ghi@
4,jkl@
];

CheckEmail:
LOAD ID as Final_ID,
Email as Final_Email_1
Resident Table1;

Join
load Id as Final_ID,
EMAIL as Final_Email_2
Resident Table2;

Left Join
load Final_ID, If(Final_Email_1 = Final_Email_2, Final_Email_1, 'Email ID not matched') as [Final Email]
Resident CheckEmail;

Final_Data:
NoConcatenate
LOAD [Final Email] as [Email ID] Resident CheckEmail where [Final Email] <> 'Email ID not matched';

Please note that I have not dropped any field or table for the presentation purpose. 

sk88024_1-1654720274027.png