Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MALKITOM
Contributor II
Contributor II

Joining 2 tables

Hello,

 

First of all I would like to say 'Hello' as  I am new to this forum. 

I have started my journey with QlikSense few weeks ago and I have resolved some issues on my own. However, going though different websites, forums etc. even if I have found answer on my question (below), solution has not been working correctly for me. Could I ask for your support?

Let's assume that I have 2 tables:

Table1:

Table1.IDTable1.NameTable1.SurnameTable1.XXX

 

Table2:

Table2.IDTable2.DescriptionTable2.Salary

 

As an output I would like to have following table:

FinalTable:

FinalTable.IDFinalTable.NameFinalTable.SurnameFinalTable.DescriptionFinalTable.Salary

 

Table1.ID and Table2.ID is field by which table should be connected (joined). It does not matter what kind of data tables contain, it just a matter to getting final outcome.

 

I would appreciate for any suggestion, help.

 

Regards,
Tom

6 Replies
Taoufiq_Zarra

@MALKITOM  like ?

FinalTable:

load Table1.ID,Table1.Name,Table1.Surname,Table1.XXX

SQL SELECT * ....;

left join // or join or right join

load Table2.ID as Table1.ID,Table2.Description,Table2.Salary
SQL SELECT * ....;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
MALKITOM
Contributor II
Contributor II
Author

It does not work for me 😞

I have made as follows:

FinalTable:

Load

Table1.ID As FinalTable.ID,
Table1.Name As FinalTable.Name,
Table1.Surname As FinalTable.Surname

RESIDENT [Table1];

SQL SELECT * FROM [Table1];

LOAD

Table1.ID AS Table2.ID,
Table2.Description As FinalTable.Description,
Table2.Salary As FinalTable.Salary,

RESIDENT [Table2];

SQL SELECT * FROM [Table2];

 

It states that 'There is no open data connection.'

Regards,
Tom

 

Taoufiq_Zarra

@MALKITOM 

FinalTable:

Load

ID As FinalTableID,
Name As FinalTableName,
Surname As FinalTableSurname

;

SQL SELECT * FROM [Table1];

left join // you can change it to right join or join

LOAD

ID As FinalTableID,
Description As FinalTableDescription,
Salary As FinalTableSalary,

;

SQL SELECT * FROM [Table2];

 

I guess the database fields are called: ID,Name,Surname from table 1 and ID,... from table 2 !

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
MALKITOM
Contributor II
Contributor II
Author

Hi,

 

Still when loading data from script I got: 'There is no open data connection'.

 

Regards,
Tom

Taoufiq_Zarra

@MALKITOM  do you have SQL connexion or ou load data from file ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
MALKITOM
Contributor II
Contributor II
Author

@Taoufiq_Zarra please find below steps that I am performing (issue described below is just part of my script code)

  1. Load data from file. Let's call it Table A.
  2. Split Table A to Table B, Table C, Table D (with Load statement, resident of Table A, with where conditions)
  3. Table B contains data that I am interested in (OK)
  4. Table C contains some data and Table D contains rest of data (those 2 tables need to be merged / joined by column field called ID - exists in both tables, some columns need to be taken from Table C, some from Table D) - this is issue described above. 

Due to security policy reason, I am not able to provide you any code sample and so on. I do my best to describe issue as much as I can.

Regards,

Tom