Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
kaushik_solanki
Not applicable

Re: Find the different fields between two tables

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

5 Replies
Not applicable

Re: Find the different fields between two tables

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

Re: Find the different fields between two tables

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.

kaushik_solanki
Not applicable

Re: Find the different fields between two tables

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

Not applicable

Re: Find the different fields between two tables

Thank you very much Kaushik!

It works

MCampestrini
Not applicable

Re: Find the different fields between two tables

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

Márcio Rodrigo Campestrini