Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Doubt regarding Join

Hi all,

I'm a QLikView learner.

I was just eager to know whether

Table:

Table1

Load * from Table1;

Join

Load * from Table2;

Join

Load * from Table3;


is same as-----------------------------------------------

Table1:

Load * from Table1;

Table2:

Load * from Table2;

Table3:

Load * from Table3;


Table4:

Load* Resident Table1;

Join

Load* Resident Table2;

Join

Load* Resident Table3;


Drop Tables Table1, Tabl2, Table3;



9 Replies
swuehl
MVP
MVP

As long as Table1, Table2, Table3 don't have the same fields, so they would autoconcatenate in the second case...

And your resulting table is differently named in the two cases.

markgraham123
Specialist
Specialist
Author

I do have a key with same name in 3 tables which joins 3 of the tables.

swuehl
MVP
MVP

No, I was talking about autoconcatenation, QV will automatically concatenate tables when they show the same number and names of fields. This will not happen if the tables only share a subset of fields (like a single key field).

markgraham123
Specialist
Specialist
Author

Hi,

I'm not able to understand the response.

swuehl
MVP
MVP

Table1:

LOAD Field1,

          Field2

FROM Table1;

Table2:

LOAD Field1,

          Field2

FROM Table2;

After script execution, there will be only Table1 in your data model, because of auto-concatenating the two tables (same number of fields and fields have same name, all fields are keys).

If you want to prevent this, use NOCONCATENATE LOAD prefix:

Table1:

LOAD Field1,

          Field2

FROM Table1;

Table2:

NOCONCATENATE

LOAD Field1,

          Field2

FROM Table2;

But now the two tables are linked by two fields --> synthetic key is created.

sunny_talwar

So I think swuehl‌ means that if the name of the fields between the three tables are exactly the same, they will auto-concatenate. These two can be safely considered equivalent:

Table:

Table1

Load * from Table1;

Join

Load * from Table2;

Join

Load * from Table3;


is same as-----------------------------------------------

Table1:

Load * from Table1;

Table2:

NoConcatenate

Load * from Table2;

Table3:

NoConcatenate

Load * from Table3;


Table4:

Load* Resident Table1;

Join

Load* Resident Table2;

Join

Load* Resident Table3;


Drop Tables Table1, Tabl2, Table3;


HTH


Best,

Sunny

markgraham123
Specialist
Specialist
Author

THanq swuehl

markgraham123
Specialist
Specialist
Author

THanq Sunny.

sunny_talwar

No problem Mark

Glad we were able to help.

Best,

Sunny