Page 1 of 1

how to fetch one custid associated with multiple processids.

Posted: Thu Sep 03, 2009 11:26 pm
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..

Posted: Fri Sep 04, 2009 2:35 am
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  ----+

Posted: Fri Sep 04, 2009 3:47 am
by Sainath.Srinivasan
Do you have columns / attributes into which you intend to allocate the multiple process-ids ?