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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Extract Not Matched Records

Hi All,

I want to extract not matched records from 2 table based on common column.

For Example:


Table 1

ID,  Amount

1,   100

2,  200

Table 2

ID, Amount

1,  100

2,  200

4,  400

Result Should be

Table

ID,  Amount

4,   400     

Regards,

NiHhal.

1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

i added a 2nd reference to the ID fields which i dropped later . 

Table1:

LOAD * INLINE [

    ID, ID1, Amount

    1, 1, 100

    2, 2, 200

];

Outer join (Table1)

LOAD * INLINE [

    ID,ID2, Amount

    1, 1, 100

    2, 2, 200

    4, 4, 400

];

FinalTable:

NoConcatenate

Load *

Resident Table1

where ID1<>ID2;

drop table Table1;

drop Fields ID1,ID2;

View solution in original post

7 Replies
JonnyPoole
Former Employee
Former Employee

Is the purpose to create 1 table without duplication ?  Or are you trying to create 2 separate  tables with a common column field whose data never matches ?  

nihhalmca
Specialist II
Specialist II
Author

For Example:


Table 1

ID,  Amount

1,   100

2,  200

Table 2

ID, Amount

1,  100

2,  200

4,  400

Result Should be

Table

ID,  Amount

4,   400         

martynlloyd
Partner - Creator III
Partner - Creator III

Try

Table1:

ID as Key1

...

TableX:

LOAD

ID,

Amount

From ...

Where Not Exists(Key1, ID)

;

JonnyPoole
Former Employee
Former Employee

i added a 2nd reference to the ID fields which i dropped later . 

Table1:

LOAD * INLINE [

    ID, ID1, Amount

    1, 1, 100

    2, 2, 200

];

Outer join (Table1)

LOAD * INLINE [

    ID,ID2, Amount

    1, 1, 100

    2, 2, 200

    4, 4, 400

];

FinalTable:

NoConcatenate

Load *

Resident Table1

where ID1<>ID2;

drop table Table1;

drop Fields ID1,ID2;

nihhalmca
Specialist II
Specialist II
Author

Thanks for reply Martyn,

I tried you example, it is giving 2 table.

I am expecting one table that should has not matched records.

Regards,

Nihhal.

tresesco
MVP
MVP

See attached sample qvw.

ashfaq_haseeb
Champion III
Champion III

Hi,

Try below

Table1:

Load * Inline [

ID,Amount

1,100

2,200];

Table2:

Load ID as ID1 ,Amount

where not Exists(ID, ID);

load * Inline [

ID, Amount

1,100

2,200

4,400

]

;

drop table Table1;

Regards

ASHFAQ