Merging Rows

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Merging Rows

Post by JezT »

I have a flat file of Account numbers and account balances. There are examples where the same account number is repeated on more than one row with more than one balance. I am wanting to create just one row per account number with a sum of all the balances for that account.

For example, below is an example of 3 rows with the same account number and the balance for each row.
12345678 50
12345678 75
12345678 60
What I therefore want to end up with is one row with the following information.
12345678 185
Any suggestions ??
Sunshine2323
Charter Member
Charter Member
Posts: 130
Joined: Mon Sep 06, 2004 3:05 am
Location: Dubai,UAE

Post by Sunshine2323 »

Hi,

Pass the rows through an Aggregator Stage sum on the balance and group on the Account Number.

Hope this helps :)
Warm Regards,
Amruta Bandekar

<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
JezT
Participant
Posts: 75
Joined: Wed Sep 15, 2004 1:52 am

Post by JezT »

Much appreciated !!

Now works fine !
Post Reply