Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how can I use 2 totally independent tables in 1 app

As a total newby (waiting my training and most likely not understanding the data model concept) I have a question.

I want in 1 app to report on 2 sets of data that do not have a relation. They do share columns names though.

Both data sets are SQL queries.

What is the correct syntax in the Data Load Editor to get these tables seperate?

I tried:

LIB CONNECT TO 'SQLSERVER_DATABASE';

[TABLE1]:

LOAD Customer_code, field1, field2 ;

SQL select t1.Customer_code, t1.field1, t1.field2 from table1 t1;

[TABLE2]:

LOAD Customer_code, fieldx, fieldy ;

SQL select t2.Customer_code, t2.field1, t2.field2 from table2 t2;

But then Qlik Sense Automatically joins these tables via the mutal Customer_code field.

I tried with concatenate, but that is not what I wat I guess, or I do not know the correct syntax:

[TABLE1]:

LOAD Customer_code, field1, field2 ;

SQL select t1.Customer_code, t1.field1, t1.field2 from table1 t1;

concatenate

[TABLE2]:

LOAD Customer_code, fieldx, fieldy ;

SQL select t2.Customer_code, t2.field1, t2.field2 from table2 t2;

That also seems to result in a joined table

With 2 seperate tables in QS, I will make 2 different sheets. Those sheets show approx same info, but from other sources, hence I want them in 1 app.

How can i do so?

Thanks,

Frank

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

Hi Frank,

you have different ways if you want to keep completely separete these two tables..

Way 1:

Use "Quality" statement:

Qualify *;

[TABLE1]:

LOAD Customer_code, field1, field2 ;

SQL select t1.Customer_code, t1.field1, t1.field2 from table1 t1;

[TABLE2]:

LOAD Customer_code, fieldx, fieldy ;

SQL select t2.Customer_code, t2.field1, t2.field2 from table2 t2;

Doing this all field names will get the table name as prefix so, for example Customer_code became TABLE1.Customer_code and TABLE2.Customer_code and so on with other fields.

Way2:

Rename the fields:

[TABLE1]:

LOAD

Customer_code as [Customer Code],

field1  as [Field 1],

field2 as [Field 2];

SQL select

t1.Customer_code,

t1.field1,

t1.field2

from table1 t1;

[TABLE2]:

LOAD

Customer_code as [Secondary Customer Code],

fieldx as [Secondary Field 1],

fieldy as [Secondary Field 2];

SQL select

t2.Customer_code,

t2.field1,

t2.field2

from table2 t2;

hope it helps

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

2 Replies
micheledenardi
Specialist II
Specialist II

Hi Frank,

you have different ways if you want to keep completely separete these two tables..

Way 1:

Use "Quality" statement:

Qualify *;

[TABLE1]:

LOAD Customer_code, field1, field2 ;

SQL select t1.Customer_code, t1.field1, t1.field2 from table1 t1;

[TABLE2]:

LOAD Customer_code, fieldx, fieldy ;

SQL select t2.Customer_code, t2.field1, t2.field2 from table2 t2;

Doing this all field names will get the table name as prefix so, for example Customer_code became TABLE1.Customer_code and TABLE2.Customer_code and so on with other fields.

Way2:

Rename the fields:

[TABLE1]:

LOAD

Customer_code as [Customer Code],

field1  as [Field 1],

field2 as [Field 2];

SQL select

t1.Customer_code,

t1.field1,

t1.field2

from table1 t1;

[TABLE2]:

LOAD

Customer_code as [Secondary Customer Code],

fieldx as [Secondary Field 1],

fieldy as [Secondary Field 2];

SQL select

t2.Customer_code,

t2.field1,

t2.field2

from table2 t2;

hope it helps

Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

Thanks.

That simple.

Can't wait until I get my training, got a load of questions 🙂