Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
hkg_qlik
Creator III
Creator III

Union

Hi,

I have two tables with all the same field names:

Table A has 28000 records (QVD)

Table B has 100,000 records (SQL Server Table)

I am loading Table A first and want to combine Table B with Table A.

While combining the TABLE A and TABLE B i want to keep all records from TABLE A but exclude the same records from TABLE B based on MEMBERID.

Usually we use union in SQL.. How can we achieve the simliar result while loading in QLikView.

Thanks,

H

1 Solution

Accepted Solutions
Not applicable

Hello, you can use the EXISTS function.

First you read the first table (TABLE_A).

Creates an additional field identifier for this table: (MEMBERID_A).

Then makes the union between tables using concatenate.

In the filter of your second table, just add the following filter:

WHERE NOT EXISTS (MEMBERID_A, MEMBERID)

Ex.:

TABLE_A:

LOAD

MEMBERID AS MEMBERID_A,

*

FROM ....

TABLE_B:

LOAD

*

FROM ....

RESULT_TABLE:

LOAD *

// DON't USE THE FIELD CREATED (MEMBERID_A)

...

RESIDENT TABLE_A;

CONCATENATE

LOAD *

RESIDENT TABLE_B

WHERE NOT EXISTS(MEMBERID_A, MEMBERID);

View solution in original post

3 Replies
SunilChauhan
Champion
Champion

you can use

Table A:

Load

.......

Join(Table A)

Table B

Load

....

hope this helps

Sunil Chauhan
hkg_qlik
Creator III
Creator III
Author

If i use join I see duplicate records for members present in Table A.

-H

Not applicable

Hello, you can use the EXISTS function.

First you read the first table (TABLE_A).

Creates an additional field identifier for this table: (MEMBERID_A).

Then makes the union between tables using concatenate.

In the filter of your second table, just add the following filter:

WHERE NOT EXISTS (MEMBERID_A, MEMBERID)

Ex.:

TABLE_A:

LOAD

MEMBERID AS MEMBERID_A,

*

FROM ....

TABLE_B:

LOAD

*

FROM ....

RESULT_TABLE:

LOAD *

// DON't USE THE FIELD CREATED (MEMBERID_A)

...

RESIDENT TABLE_A;

CONCATENATE

LOAD *

RESIDENT TABLE_B

WHERE NOT EXISTS(MEMBERID_A, MEMBERID);