Qlik Community

Qlik Sense Data Connectivity

Discussion board where members can learn more about Qlik Sense Data Connectivity.

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
Valued Contributor

Re: how can I use 2 totally independent tables in 1 app

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

2 Replies
micheledenardi
Valued Contributor

Re: how can I use 2 totally independent tables in 1 app

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

Not applicable

Re: how can I use 2 totally independent tables in 1 app

Thanks.

That simple.

Can't wait until I get my training, got a load of questions :-)

Community Browser