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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
SissyJones
Contributor
Contributor

Join Data from Multiple Tables into One Sheet

Hello all,

I am trying to build an employee database.  We have 2 types of employees that have data on different tables. I would like to pull specific data for each employee type from the respective tables.  The kicker is, I want them to be in one table.  For instance, I want "Title" for employee type 1 to come from table 1, but I want Title for Employee Type 2 to come from Table 2.  I want them to be pulled into the same column in my sheet.

I named each of the fields from the different tables the same name, but that gives me additional synthetic keys.  I already have the employee number as the synthetic key.

I included a diagram of what I am trying to accomplish.

Any suggestions?

Labels (1)
1 Reply
rubenmarin

Hi, you can create a temporary table concatenating table1 and table2, and if not exists add a EmployeeType for each table, like:

tmpEmployeeAdditionalData:
LOAD ...Fields...
  1 as EmployeeType
Resident/From...Table1;

Concatenate (tmpEmployeeAdditionalData)
LOAD ...Fields...
  2 as EmployeeType
Resident/From...Table2;

Then you can an inner join with emp_no and emp__type renamed as EmpoyeeType and each employee will only keep the row that merges whit their employee type.