Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
tvisha
Creator II
Creator II

How to join Multiple tables in Qlik Sense

Hi,

I have 4-5 tables. I want to join each other.

The first three courses, organization, and registrations are linked together by courseid and orgid.

The fourth is linked by hrid

How do I link the table hr_positions and department as they are not linked to tblcourses but linked to human_resources table? 

Qualify*;

tblCourses:
LOAD "COURSE_ID" as CourseId,
    DESCRIPTION,   
    "ORG_ID" as OrgId,

SQL SELECT  *
FROM COURSES
 where COURSE_TYPE='W';

left join (tblCourses)
LOAD  "ORG_ID" as OrgId,
    "ORG_NAME",

SQL SELECT *
FROM  ORGANISATIONS;

left Join (tblCourses)
LOAD "COURSE_ID" as CourseId,
        "HR_ID" as HRID;

SQL SELECT *
FROM  REGISTRATIONS;

HUMAN_RESOURCES:
left join (tblCourses) 
LOAD "HR_ID" as HRID,

SQL SELECT *
FROM "HUMAN_RESOURCES";
Left join (tblcourses) --- How do I join HRID to above registration table

LOAD "pid" as Pid,
    "hr_id" as HRID;

SQL SELECT *
FROM hr_positions;
left join (tblCourses)

 LOAD "pid" as pid,
Description,

SQL SELECT *
FROM department;
2 Solutions

Accepted Solutions
Digvijay_Singh

We keep key field name same in two tables to associate them. We don't need to join them in the script if we don't need to. Qlik manages the joins in the charts  during runtime if we have chart fields coming from different tables.

View solution in original post

Digvijay_Singh

The joining looks okay in your data model view, looks like something is wrong with the keyfield values.

Can you create new field HR_ID1 in the table as shown below, and share the values of it, I want to know why this table ref-dept-hr table values are not associating with the HUMAN_RESOURCES table.

Digvijay_Singh_0-1646843992451.png

 

View solution in original post

20 Replies
Digvijay_Singh

Why do you need to join them? You may keep them separate and associated with the remaining tables using the IDs you got.

tvisha
Creator II
Creator II
Author

What do you mean by associate here? Is it not like joining?

Digvijay_Singh

We keep key field name same in two tables to associate them. We don't need to join them in the script if we don't need to. Qlik manages the joins in the charts  during runtime if we have chart fields coming from different tables.

tvisha
Creator II
Creator II
Author

Thank You

tvisha
Creator II
Creator II
Author

one question, but when it auto joins, it would be always a inner join. If we have to do left or right or full then?

Digvijay_Singh

It won't be inner join, it would be left or right based on how do we sequence our dimensions.

tvisha
Creator II
Creator II
Author

Thank you for your reply.

Somehow, the last 2 are not working properly.

When I join these 2 tables, it is doing the right outer join with the positions table, whereas it needs to be the inner join. Anything wrong with my statements

Qualify*;

LOAD "HR_ID" as HRID,
    "HR_TYPE",
    SURNAME,
    "FULL_NAME";

SQL SELECT *
FROM HUMAN_RESOURCES";

LOAD "hr_id" as HRID ,
  "position_id" as PositionId;   

SQL SELECT *
FROM Positions

Position id is number(9,0)
Hr_id is varchar(10)

 

Digvijay_Singh

Inner join needs to be explicitly done in the script, any issue in this below? I think after this Human resources and position table will have records for the matching HRIDs only.

Table1:

LOAD "HR_ID" as HRID,

    "HR_TYPE",

    SURNAME,

    "FULL_NAME";

SQL SELECT *

FROM HUMAN_RESOURCES";

 

Inner Join(Table1)

LOAD "hr_id" as HRID ,

  "position_id" as PositionId;   

SQL SELECT *

FROM Positions

tvisha
Creator II
Creator II
Author

Unfortunately it is not working