how to solve this

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
harikumar
Participant
Posts: 33
Joined: Wed Apr 21, 2010 9:19 pm
Location: banglore

how to solve this

Post by harikumar »

the source table sal
empno deptno sal
1 10 10,000
2 20 20,000
3 30 30,000
1 40 15,000
2 50 22,000
3 60 25,000
. . .
. . .
. . .
. . .
. . .
. . .
find the which employ having max(sal) in which deptno(output should be display all columns)


target like this
----------
empno deptno sal
1 40 15,000
2 50 22,000
3 60 25,000
. . .
. . .
. . .
. . .
. . .
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

You can use an aggregator to group by on empno, deptno and get the max(sal). You can use a Remove Duplicates Stage with empno, deptno as the keys and you can sort the data on sal and retain the value you want.
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... or just an inner join on empno and sal once the max has been determined in the Aggregator stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply