Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Amusing Qlikview

Hello,

I found this a bit amusing (see attachment picture)

Anyone  can explain this?

Basicly I load 2 tables, like this. Why it creates syn table? :S

FIX:

LOAD COMPANY

1 as T

RESIDENT FIX;

INNER JOIN

LOAD

COMPANY

RESIDENT T_MAP;

FIX:

LOAD COMPANY

2 as T

RESIDENT FIX;

INNER JOIN

LOAD

COMPANY

RESIDENT T_MAP;

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

kristaps.ozols wrote:

But.. Normally when table has same columns, Q merges to one table. I am excpecting same behavior. You can try this with two inline tables. I think inner join is cousing some problems, and Q doesnt execute/skip than process.

If you want a standard join between the two tables you mustn't name the second table.  Try this:

FIX:

LOAD

     COMPANY,

     1 as T

RESIDENT FIX;

INNER JOIN (FIX)

LOAD

     COMPANY

RESIDENT T_MAP;

JOIN (FIX)

LOAD

     COMPANY,

     2 as T

RESIDENT FIX;

INNER JOIN (FIX)

LOAD

     COMPANY

RESIDENT T_MAP;

However, note that this is 4 steps all consecutively acting on the table FIX. As cmaneglia says, you may want to build the tables separately first:

FIX:                    //this is the main table

LOAD

     COMPANY,

     1 as T

RESIDENT FIX;

INNER JOIN (FIX)     //inner join to main table

LOAD

     COMPANY

RESIDENT T_MAP;

FIX_temp:     //create a temp table

NoConcatenate     //this is necessary to prevent an automatic join as the fields will be the same

LOAD

     COMPANY,

     2 as T

RESIDENT FIX;

INNER JOIN (FIX_temp)     //inner join to the temp table

LOAD

     COMPANY

RESIDENT T_MAP;

JOIN (FIX)     //define the table to join to

LOAD

     *

RESIDENT FIX_temp;     //join temp table to main one

DROP TABLE FIX_temp;     //to prevent syn keys as the temp table is no longer needed.

Remember to be sure you are using the correct JOIN type.  Read about the difference in the F1 help.

Jason

PS - just looking through the field names I wonder if any of this is the right option for you.  What are you trying to do here?

View solution in original post

5 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Your 2 tables have a same name and the same fields. QV won't let the names be the same so it has named one of them FIX-1. The syn table is because all the fields are the same and the associate technology of QV will link on all matching fields. Synthetic keys are created when there is more than one matching field; they are effectively a combination of all the similar fields to create just one link.

You need to review your data model.

Hope this helps,

Jason

Not applicable
Author

But.. Normally when table has same columns, Q merges to one table. I am excpecting same behavior. You can try this with two inline tables. I think inner join is cousing some problems, and Q doesnt execute/skip than process.

Not applicable
Author

Hi.

If Qlik find two tables with the same fields usually performs a concatenate.

Probably, in your case, the two join Qlik require to keep separate the two structures upto join them.

In your case you should use two temporary tables in memory, make the explicit concatenate and destroy the temporary tables.


Not applicable
Author

Yes, i think it too, but this  behavior seemed strange. When i used comand Concatenate, it created cross join of those tables.

Jason_Michaelides
Luminary Alumni
Luminary Alumni

kristaps.ozols wrote:

But.. Normally when table has same columns, Q merges to one table. I am excpecting same behavior. You can try this with two inline tables. I think inner join is cousing some problems, and Q doesnt execute/skip than process.

If you want a standard join between the two tables you mustn't name the second table.  Try this:

FIX:

LOAD

     COMPANY,

     1 as T

RESIDENT FIX;

INNER JOIN (FIX)

LOAD

     COMPANY

RESIDENT T_MAP;

JOIN (FIX)

LOAD

     COMPANY,

     2 as T

RESIDENT FIX;

INNER JOIN (FIX)

LOAD

     COMPANY

RESIDENT T_MAP;

However, note that this is 4 steps all consecutively acting on the table FIX. As cmaneglia says, you may want to build the tables separately first:

FIX:                    //this is the main table

LOAD

     COMPANY,

     1 as T

RESIDENT FIX;

INNER JOIN (FIX)     //inner join to main table

LOAD

     COMPANY

RESIDENT T_MAP;

FIX_temp:     //create a temp table

NoConcatenate     //this is necessary to prevent an automatic join as the fields will be the same

LOAD

     COMPANY,

     2 as T

RESIDENT FIX;

INNER JOIN (FIX_temp)     //inner join to the temp table

LOAD

     COMPANY

RESIDENT T_MAP;

JOIN (FIX)     //define the table to join to

LOAD

     *

RESIDENT FIX_temp;     //join temp table to main one

DROP TABLE FIX_temp;     //to prevent syn keys as the temp table is no longer needed.

Remember to be sure you are using the correct JOIN type.  Read about the difference in the F1 help.

Jason

PS - just looking through the field names I wonder if any of this is the right option for you.  What are you trying to do here?