Help in designing the job

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
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Help in designing the job

Post by devidotcom »

Hi All,

I have the following requirement and have to design a job to meet the same.
The source Table A has to load target Table B with hierarchy information.

For Example
Table A

Parent Column Child Column
200 100
300 200
600 500
800 700
1000 900

Table B

Level_1 Level_2 Level_3
100 200 300
500 600 700
900 1000 1000

So basically the child 100's parent is 200 who's parent is 300. The child 900 has only one parent 1000 and hence the level_3 will have the same value as Level_3.
Here Level_1 is the lowest level.

Thanks
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

select t1.parent, t1.child, t2.parent
from tablea t1 left outer join tablea t2
on t1.parent = t2.child
In transformer check if t2.parent is null if yes then assign t1.parent
You are the creator of your destiny - Swami Vivekananda
devidotcom
Participant
Posts: 247
Joined: Thu Apr 27, 2006 6:38 am
Location: Hyderabad

Post by devidotcom »

Thank you!! Will code and post if resolved.
Post Reply