Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a table like this
| EmpID | EmpName | MgrID | 
| 200 | Steve | 0 | 
| 201 | Mark | 200 | 
| 202 | Mathew | 201 | 
the scenario here is, Steve doesnt have a manager, Steve is the manager of Mark, and Mark is the manager of Mathew,
My output table should look like
| MgrID | ManagerName | 
| 0 | - | 
| 200 | Steve | 
| 201 | Mark | 
Thanks and regards
Renjith
Hi Renjithpl,
Try this script
[TMP1]:
LOAD * INLINE [
EmpID, EmpName, MgrID
200, Steve, 0
201, Mark, 200
202, Mathew, 201];
[tmpMapping]:
MAPPING
LOAD
EmpID,
EmpName
RESIDENT [TMP1];
[MGR]:
LOAD
MgrID,
APPLYMAP('tmpMapping',MgrID,'-') AS [MgrName]
RESIDENT [TMP1];
DROP TABLE [TMP1];
Do let me know, if this one help you.
Regards,
Sokkorn
Hi,
Attached an sample for your reference. Hope this resolve your issue.
Hi Renjithpl,
Try this script
[TMP1]:
LOAD * INLINE [
EmpID, EmpName, MgrID
200, Steve, 0
201, Mark, 200
202, Mathew, 201];
[tmpMapping]:
MAPPING
LOAD
EmpID,
EmpName
RESIDENT [TMP1];
[MGR]:
LOAD
MgrID,
APPLYMAP('tmpMapping',MgrID,'-') AS [MgrName]
RESIDENT [TMP1];
DROP TABLE [TMP1];
Do let me know, if this one help you.
Regards,
Sokkorn