Finding Relationship

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
Murali4u
Participant
Posts: 37
Joined: Sun Feb 21, 2010 12:27 pm

Finding Relationship

Post by Murali4u »

Guys,
This may sound silly, but i dont know this could be achieved in datastage or through simply query, dont go for any stored procedures.
Let me describe with simple example.

I have a table with rows
A B
1 2
2 3

If we look into the relationship of the element B with element A for the value as '3'

The data should be represented as
1 2
1 3
Since 3 has the relationship with the top element as '2' and 2 has 1 so the relationship with 2 and 3 has the top level element as 1 only.
Another Ex:

A B
1 2
2 3
4 5
2 6

Transformed to :

1 2
1 3
4 5
1 6

Thanks in Advance..
Rockzz Tech
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

This is where recursive sql comes in. If your source is DB2, look into the 'WITH' clause and in oracle its 'connect_by_prior'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Murali4u
Participant
Posts: 37
Joined: Sun Feb 21, 2010 12:27 pm

Post by Murali4u »

[quote="DSguru2B"]This is where recursive sql comes in. If your source is DB2, look into the 'WITH' clause and in oracle its 'connect_by_prior'. ...[/quote]

Thanks Dsguru. when i used "connect by prior" it works fine.
Rockzz Tech
Post Reply