Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error Merging Two Tables with Exactly the Same Fields

Hi,

I have been struggling to merge two tables containing exactly the same fields.  The Implicit merging (concatenation) of the tables are not taking place.

Tables are derived from different sources, but contain exactly the same fields.  Tables (REFDOC_106 and REFDOC)

Please see below for table view.

asdf.PNG

Could anyone please help point me in the right direction?  The tables have been created themselves, in other words there has been joins used previously in order to obtain the final product which are these tables. Could that possibly have an effect?

Thanks in advance.

7 Replies
vishsaggi
Champion III
Champion III

Did you use CONCATENATE keyword between these tables?

Table1:

LOAD * FROM XYZTablename;

CONCATENATE

Table2:

LOAD * FROM ABCTablename;

Anonymous
Not applicable
Author

I tried the below.  However, no tables remained.  Thus, table 1 concatenated with the refdoc etc.

Table1:

LOAD * Resident REFDOC;

DROP TABLE REFDOC;

CONCATENATE

Table2:

LOAD * Resident REFDOC_106;

DROP TABLE REFDOC_106

This didnt work, seems implicit concatenation resulted in Table 1 merging with refdoc and table 2 merging with redoc106 before i dropped them.

Without the drop statements it gives exactly the same result as the first screenshot i posted.  Any idea what this means?

sinanozdemir
Specialist III
Specialist III

Hi,

As you said Table1 is merging with REFDOC table so what I would do is to add a new column, a dummy column so that Table1 and Table2 don't get concatenated to the original tables:

Table1:

LOAD *, 'Table1' As [Table ID] Resident REFDOC;

DROP TABLE REFDOC;

Concatenate(Table1)

Table2:

LOAD *, 'Table2' As [Table ID] Resident REFDOC_106;

DROP TABLE REFDOC_106;

Hope this helps

vishsaggi
Champion III
Champion III

Does REFDOC and REFDOC_106 tables have same number of fields and field names ?

If they have, why you want to do a resident you can directly use Concatenate between both like

LOAD * FROM REFDOC;

CONCATENATE

LOAD * FROM REFDOC_106;

Just wondering what resident load is used for here?

Anonymous
Not applicable
Author

That was the answer, thank you very much !

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you do not want to create new columns that you maybe won't use later on anyway, add the prefix NOCONCATENATE to the Table1 LOAD statement. That prefix will inhibit the Table1 LOAD from concatenating all rows to REFDOC.

Whenever you make a simple copy of one resident table, pay attention to where the copy ends up. QlikView may decide to perform an unexpected AUTOCONCATENATE, even when you name the copy differently. That's one of those things...

Peter.