self join

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

self join

Post by dsa »

Hi,

Suppose I have data which has 3 columns - emp_id, emp_name and mgr_id where mgr_i is emp's manager's id.

I need to know how many employees are there who does not manage anyone.

One approach might be self join but is anybody having any idea how it can be implemented in datastage without using self join?
jcthornton
Premium Member
Premium Member
Posts: 79
Joined: Thu Mar 22, 2007 4:58 pm
Location: USA

Post by jcthornton »

I am curious if this is an interview question or if something in particular has prompted this??? Looking at your other posts it is hard to tell since it looks like you have some knowledge of the tool, but with curious gaps.

I am hoping that this means you are working at a licensed client and are being asked to do things that require you to learn more about the tool. Just in case I am wrong, my answers are going to be abbreviated so that the full answer can be worked out rather than answer in full.

Assuming by self-join that you mean a join in the database, then yes - there are several options you can choose in DS. The first methods that I can think of off the top of my head include:

1) a funnel and aggregator
2) using a reject link
3) using merge.

If this comes across as too cynical, I apologize in advance.
Jack Thornton
----------------
Spectacular achievement is always preceded by spectacular preparation - Robert H. Schuller
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

I think merge and reject would do it.... I am not sure why funnel ad aggregator are needed.
jcthornton
Premium Member
Premium Member
Posts: 79
Joined: Thu Mar 22, 2007 4:58 pm
Location: USA

Post by jcthornton »

dsa,

Those options are each a different way to perform the same task. You only need 1 of the 3, not all 3.
Jack Thornton
----------------
Spectacular achievement is always preceded by spectacular preparation - Robert H. Schuller
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

got it

thanks!!!
Post Reply