How do I capture the values and write from duplicate 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
ashok
Participant
Posts: 43
Joined: Tue Jun 22, 2004 3:04 pm

How do I capture the values and write from duplicate rows

Post by ashok »

How do I capture the values and write to one row from duplicate customer ids, example:

100 1 AB1
100 2 AB3
100 3 AB2
100 2 AB4



I should delete DUPLICATE customerID, and I should get one row as follows:
CUSTOMERID AB1 AB2 AB3 AB4
100 1AB1 2AB3 3AB2 2AB4
ashok
Participant
Posts: 43
Joined: Tue Jun 22, 2004 3:04 pm

Post by ashok »

sorry it should be like this
How do I capture the values and write to one row from duplicate customer ids, example:

100 , 1, AB1
100 , 2, AB3
100 , 3, AB2
100 , 2, AB4



I should delete DUPLICATE customerID, and I should get one row as follows:
CUSTOMERID, AB1, AB2, AB3, AB4
100 , 1AB1, 2AB3, 3AB2, 2AB4
kura
Participant
Posts: 21
Joined: Sat Mar 20, 2004 3:43 pm

Post by kura »

If you search vertical pivoting in the forum, you should able to find something.

solution:

use row process function in the transformer, which compares the previous with present row. If present value same as previous row value(customer id) then populate you input filed into their corresponding target fields and rest of the columns with zeros. Finally use an aggregator grouping on customer id and max function rest of fields.

Best solution from performance point view, write into work table in the database and write pivot query.

Vijay


[quote="ashok"]sorry it should be like this
How do I capture the values and write to one row from duplicate customer ids, example:

100 , 1, AB1
100 , 2, AB3
100 , 3, AB2
100 , 2, AB4



I should delete DUPLICATE customerID, and I should get one row as follows:
CUSTOMERID, AB1, AB2, AB3, AB4
100 , 1AB1, 2AB3, 3AB2, 2AB4[/quote]
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi Ashok,

There was a similar discussion on this topic last week. Check if this link helps

viewtopic.php?t=89216

Rgds
--Rich

Pride comes before a fall
Humility comes before honour
Post Reply