Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

How to merge 2 resident tables ?

Hi everyone,

In my model, there are 2 tables which are linked on a common field.  I would like to merge them so I have only one table and then export it into qvd.

I've tried this piece of code :

MergeTable:

LOAD *

resident Table1;

LEFT JOIN

LOAD *

resident Table2

;

But it doesn't work, I still have the 2 tables in my model.

What do I have to do ?

Thanks

1 Solution

Accepted Solutions
fernando_tonial
Valued Contributor

Re: How to merge 2 resident tables ?

Hi Laura,

Try this.

Noconcatenate

MergeTable:

LOAD *

resident Table1;

LEFT JOIN (MergeTable)

LOAD *

resident Table2;

Drop Table Table1, Table2;

Best Regards.

Tonial.

10 Replies
Not applicable

Re: How to merge 2 resident tables ?

Hi Laura,

You need to drop the two residents tables e.g.

Drop Tables Table1, Table 2;

richard_chilvers
Contributor III

Re: How to merge 2 resident tables ?

Hi Laura

Does MergeTable end up with the whole of the merged data.

If so, remember to DROP TABLE Table2, so that it is removed from your model.

Hope that helps.

Not applicable

Re: How to merge 2 resident tables ?

Thanks for your help.

I have added : drop tables Table1, Table2   but then I lose my tables and still don't get the merged table

Could it come from the fact that I renamed fields in when I first load the resident tables ? I mean I have :

Table1:

Load

field1 as key,

field2

FROM ....  (qvd);

Table2 :

Load

F1 as key,

F2

FROM ... (qvd);

But I don't think so because when I don't try to join them, the link is done by qlikview.

Any other ideas ?

neetha_p
Honored Contributor

Re: How to merge 2 resident tables ?

Hi,

MergeTable:

LOAD *

resident Table1;

join

LOAD *

resident Table2;

DROP Table Table1,Table2;

STORE MergeTable into ..\QVD\MergeTable.qvd;

Regards

Neetha

Employee
Employee

Re: How to merge 2 resident tables ?

You  can try being explicit in the joining as follows. It should definitely work if they have common field names.  Then as before, drop Table1 and Table2.

MergeTable:

LOAD *

resident Table1;

LEFT JOIN (MergeTable)

LOAD *

resident Table2

fernando_tonial
Valued Contributor

Re: How to merge 2 resident tables ?

Hi Laura,

Try this.

Noconcatenate

MergeTable:

LOAD *

resident Table1;

LEFT JOIN (MergeTable)

LOAD *

resident Table2;

Drop Table Table1, Table2;

Best Regards.

Tonial.

Not applicable

Re: How to merge 2 resident tables ?

Hi Laura,

You should try smthing like;

Table1:

Load

......;
Table2:

Load

......;

Merge_Table:

Load

......Resident Table1

Left Join(Merge_Table)

Load

.......Resident Table2;

Drop Tables Table1, Table2;

Hope it helps !

Cheers !

Employee
Employee

Re: How to merge 2 resident tables ?

Almost certainly its because you are auto concatenating . See post above ... are you sure 'noconcatenate' is used immediately above the 'MergedTable:' line ?

Not applicable

Re: How to merge 2 resident tables ?

Thank you Fernando !! That's it ! There was no "noconcatenate".

Have a great day everyone !

Community Browser