Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to do NOT IN Statement when doing a load from a Resident table

Hello,

I'm stuck at not being able to do not in statement during the load statement of one of the resident table. Here's my scenario:

Table 1:

ID, T1_Field1, T_1Field2

1, f1A, F2A

2, f1B, F2B

3, f1C, F2C

Table 2:

ID, T2_Field1, T_2Field2

2, f1B, F2B

I need to get all the records from Table 1 that is not in Table 2

So my result of my query should result:

Table 1:

ID, T1_Field1, T_1Field2

1, f1A, F2A

3, f1C, F2C

Note: Both of these tables are resident tables. Thanks in advance.

-Samir





1 Solution

Accepted Solutions
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi Samir,

check this sample code:



Table1:
load * inline [
ID, T1_Field1, T_1Field2
1, f1A, F2A
2, f1B, F2B
3, f1C, F2C
];

Table2:
noconcatenate
load * inline [
ID2, T2_Field1, T_2Field2
2, f1B, F2B
];

DesiredTable:
noconcatenate
load * resident Table1
where not exists (ID2, ID);

drop table Table1, Table2;




Hope this helps you.

Regards,

Fernando

View solution in original post

2 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi Samir,

check this sample code:



Table1:
load * inline [
ID, T1_Field1, T_1Field2
1, f1A, F2A
2, f1B, F2B
3, f1C, F2C
];

Table2:
noconcatenate
load * inline [
ID2, T2_Field1, T_2Field2
2, f1B, F2B
];

DesiredTable:
noconcatenate
load * resident Table1
where not exists (ID2, ID);

drop table Table1, Table2;




Hope this helps you.

Regards,

Fernando

Not applicable
Author

Thanks! That did the trick.