how to fetch one custid associated with multiple processids.

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
praburaj
Premium Member
Premium Member
Posts: 133
Joined: Thu Jun 30, 2005 1:26 am
Location: philippines

how to fetch one custid associated with multiple processids.

Post by praburaj »

Hi

I have table with

processId CustId
1 z101
2 z101
3 z102
4 z103
1 z103


I want for each custId ---- corresponding ProcessIds should be taken.

Ex: for z101----- ProcessIds are 1,2

I have further codings with that each processId values.

this something like a nested for loop in C Coding

For(..)
{
for(..)
{ ----}
}

how to implement this in either dB2 query or in datstage..

Plz help me to resolve this.

Any help is appreciated..

thanks in advance..
prabakaran.v
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

select CustID, Count(*) from table group by CustID having Count(*) > 1;
In DataStage split your stream of rows into two using a Copy stage, and count the rows for each CustID group in an Aggregator on one of those streams before joining the two streams (using a Join stage) on CustID. Filter only those rows that have a count > 1. This is called a "fork join" stage.

Code: Select all

---->  Copy  ----------------->  Join  ----->  Filter  ----->
          |                       ^
          |                       |
          +---->  Aggregator  ----+
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Do you have columns / attributes into which you intend to allocate the multiple process-ids ?
Post Reply