Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Self join in script

Hi Folks,

How can we do self join in expression of straight table.

Data is

EmpName,ID_Emp,ID_Sup,Sales

ABC,1,2,21

XYZ,2,3,32

ZDC,3,4,4

LMN,4,5,33

I Need straight table with

SupID  SupName EmpID

2     XYZ   1

3     ZDC  2

4     LMN  3

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

You do not need any join, just reload with NoConcatenate the fields you need

alexandros17
Partner - Champion III
Partner - Champion III

TableA:

Load EmpName,ID_Emp,ID_Sup,Sales Resident ...

TableB:Noconcatenate

Load

ID_Sup as SupID, EmpName as   SupName, Id_Emp as  EmpID resident TableA;

drop table TableA;

Not applicable
Author

I can't reload, I will have to write something in expression of table.

alexandros17
Partner - Champion III
Partner - Champion III

So write a table with the fields you need, if you need a chart then add an expression with 1 as value then hide the column

Not applicable
Author

Could you please share a qvw with example, as I have already tried adding in table.

Not applicable
Author

Any help would be really appreciated.

hic
Former Employee
Former Employee

This looks like a hierarchy to me, where ID_Emp is the NodeID and ID_Sup is the ParentID. If so, you should look at the Hierarchy prefix.

See more on Unbalanced, n-level hierarchies

In any case, you cannot make a join in a straight table. You need to do it in the script.

HIC