Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Same table being loaded twice

Hello, all .

I cannot find the answer to this in the manual.  Please tell me why the following code loads test_table_1 twice instead of test_table_1 and then test_table_2?

test_table_1:

sql select  ...

...;

test_table_2:

sql select  ...

...;

What am I missing?  Many thanks in advance.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If the two select statements return the same number of columns with the same names then the results of the second select statement are automatically added to the first table. That's the default behavior of Qlikview. If you don't want that you have to specify the noconcatenate keyword above the second select statement or use the Qualify keyword so the fieldnames are prefixed with the table name thus making them unique.

test_table_1:

sql select  ...

...;

Noconcatenate // or Qualify * ;

test_table_2:

sql select  ...

...;

Note, this will result in a big synthetic key and probably performance problems. It's better to concatenate the two results and create a field to store where the data came from:

test_table_1:

sql select  ..., 'fromsource1' as Source

...;

sql select  ..., 'fromsource2' as Source

...;


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
mphekin12
Specialist
Specialist

Kevin,

It looks like you are missing LOAD statements.  Try this:

test_table_1:

      Load

          ...

     ;

sql select  ...

...;

test_table_2:

    Load

          ...

     ;

sql select  ...

...;

Anonymous
Not applicable
Author

Kevin,

Not enough information.  And, it is unlikley that it has anyhting to do with the preceeding load.  Can you provide a little more info?  Maybe upload an example?

Regards,

Michael

Not applicable
Author

Kevin,

Would you please provide the complete load script?

Thanks,

Aji Paul.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If the two select statements return the same number of columns with the same names then the results of the second select statement are automatically added to the first table. That's the default behavior of Qlikview. If you don't want that you have to specify the noconcatenate keyword above the second select statement or use the Qualify keyword so the fieldnames are prefixed with the table name thus making them unique.

test_table_1:

sql select  ...

...;

Noconcatenate // or Qualify * ;

test_table_2:

sql select  ...

...;

Note, this will result in a big synthetic key and probably performance problems. It's better to concatenate the two results and create a field to store where the data came from:

test_table_1:

sql select  ..., 'fromsource1' as Source

...;

sql select  ..., 'fromsource2' as Source

...;


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks G.W.  That's what I needed.  Still a little rusty as it has been a few years.  Thanks again!

And thanks to others for replying also :-).