Page 1 of 1

self join

Posted: Fri Oct 15, 2010 6:24 am
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?

Posted: Fri Oct 15, 2010 10:57 am
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.

Posted: Fri Oct 15, 2010 11:34 am
by dsa
I think merge and reject would do it.... I am not sure why funnel ad aggregator are needed.

Posted: Fri Oct 15, 2010 11:48 am
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.

Posted: Fri Oct 15, 2010 12:00 pm
by dsa
got it

thanks!!!