Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

table join

i have two tables for employee record keeping

  • Action table, keeping all the actions performed on employee eg hiring, redesignation, leaving
  • Organizational assignment table, keeping the data of the organizational assignments of the employee

TABLE1

Employee
Action
StartDate
EndDate
ARedesignation10-10-201131-12-9999
BHiring12-10-201131-12-9999

TABLE2

EmployeeStartDate
EndDateDepartment
A10-10-201131-12-9999ABC
A01-01-199009-10-2011XYZ

The employee "A' is hired in 'XYZ' department and worked there from his hiring to 09-10-2011 and redesignated to dept 'ABC' from 10-10-2011 .

How to find a table containng the complete transfer info for an employee.

Employee     TransferOn     FRomDept     ToDept

7 Replies
SunilChauhan
Champion II
Champion II

qualify *;

Unqulify Employee;

table1:

Load

Employee,

Action,

Start Date,

enddate

from Table1

table2:

load

Employee,

Start Date,

enddate

,

Depaartment

from Table 2

hope this help

Sunil Chauhan
Not applicable
Author

thanks sunil

my fieldnames are not same but the data is same, how this qualify will work in my case??

Qualify joins the similar data or column having same name??

TABLE1

Employee.TAB1
Action.TAB1
StartDate.TAB1
EndDate.TAB1
ARedesignation10-10-201131-12-9999
BHiring12-10-201131-12-9999

TABLE2

Employee.TAB2StartDate.TAB2
EndDate.TAB2Department.TAB2
A10-10-201131-12-9999ABC
A01-01-199009-10-2011XYZ
perumal_41
Partner - Specialist II
Partner - Specialist II

table1:

Load

Employee.Tab1 AS Employee,

Action.Tab1,

Start Date.Tab1,

enddate.Tab1

from Table1

table2:

load

Employee.Tab2 AS Employee,

Start Date,.Tab2,

enddate.Tab2

,

Depaartment

from Table 2

Try This Method

SunilChauhan
Champion II
Champion II

use tab1 like below

in Table1 rename

no need to use qualify

Employee.TAB1 as  Employee.TAB2

hope this help



Sunil Chauhan
Not applicable
Author

i am afraid this is not serving the purpose.i want a new table in this format:

Employee     TransferOn     FRomDept     ToDept

jagan
Luminary Alumni
Luminary Alumni

Hi,

TempTable:

Load

     Employee,

     Action,

     [Start Date],

     enddate

from Table1;

Left Join

load

     Employee,

     [Start Date] AS Tab2StartDate,

     enddate AS Tab2EndDate,

     Department

from Table 2;

TempData:

LOAD

     Employee,

     Tab2StartDate AS TransferOn,

     If(Employee = previous(Employee) AND Action = 'ReDesignation', Previous(Department)) AS FromDepartment,

     If(Employee = previous(Employee) AND Action = 'ReDesignation', Department, 'Temp') AS ToDepartment

RESIDENT TempTable

ORDER BY Tab2StartDate;

FinalData:

LOAD

*

RESIDENT TempData

WHERE ToDepartment <> 'Temp';

Drop table TempData;

DROP TABLE TempTable;

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

thank u jagan for ur reply.
but m really afraid this is not serving the purpose..
can u plz look into it??

Thanks & Regards