Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Find the different fields between two tables

Good morning and good Monday everyone!


I need to find the differences (the different fields) between two tables.
For example:

Table A:

A1     Bzw998

A2     Cdw955

A3     Yxp900

A5     Djj244

A7     Mnw104

A8     Vbc456

A9     Rtk777

Table B:

A1     Bzw998

A2     Cdw955

A4     Ghk888

A5     Djj244

A6     Ell777

A7     Mnw104

A8     Vbc456

Table result:

A3     Yxp900

A4     Ghk888

A6     Ell777

A9     Rtk777

How can I do this?
Maybe with OUTER JOIN?

Thanks in advance!

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try below code.

     This will clear your idea.

Inclusion:
Load id as Temp_ID FROM a;

Inner Join
Load id as Temp_ID FROM b;

Exclusion:
Load id,name FROM A Where not exists(Temp_ID,id);

Concatenate
Load id,name FROM B Where not exists(Temp_ID,id);

Drop table Inclusion;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

5 Replies
Not applicable
Author

also run this code

TableA:

load * inline [

id, name

A1,     Bzw998

A2,     Cdw955

A3,     Yxp900

A5,     Djj244

A7,     Mnw104

A8,     Vbc456

A9,     Rtk777

];

join

TableB:

load * inline [

id, name

A1,     Bzw998

A2,     Cdw955

A4,     Ghk888

A5,     Djj244

A6,     Ell777

A7,     Mnw104

A8,     Vbc456

];

Result:

load id as newid, name as newname

resident TableA

where match(id,'A3','A9','A4','A6');

drop table TableA;

then output like this

newidnewname
A3Yxp900
A4Ghk888
A6Ell777
A9Rtk777
Not applicable
Author

Thanks vishwaranjan.

But I'm finding a generic solution.

The tables mentioned are examples, but the fields are not fix.

I will use the script to find the differences between a txt result of reading each bar code from clothes from our provider and compare the fields with our reading.

Thanks.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Try below code.

     This will clear your idea.

Inclusion:
Load id as Temp_ID FROM a;

Inner Join
Load id as Temp_ID FROM b;

Exclusion:
Load id,name FROM A Where not exists(Temp_ID,id);

Concatenate
Load id,name FROM B Where not exists(Temp_ID,id);

Drop table Inclusion;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Thank you very much Kaushik!

It works

Marcio_Campestrini
Specialist
Specialist

Thanks Kaushik. I was facing this problem until I've found your post.

Márcio Rodrigo Campestrini