Sum , Sort and Get Results
Posted: Thu Jul 20, 2006 6:15 pm
Hi,
I have a flat file which has data in the following format
Dept Emp Sal
10 50 1000
10 50 2000
10 50 2000
10 20 3000
10 20 3000
10 20 4000
I am interested in picking up the employee , where sum(sal) is the highest.In the above case the expected result is
Dept Emp Sal
10 20 10000
This is how i am doing it
1) Aggregator Transformation -- Sum Sal group by Dept and Emp
Results
Dept Emp Sal
10 50 5000
10 20 10000
2) Sort Transformation - Sort the data based on sal
Results
Dept Emp Sal
10 20 10000
10 50 5000
3) Aggregator Transformation - Pick up the first record
Results
Dept Emp Sal
10 20 10000
Is there a better way of acheiving the same results .
Please help?
Sam
I have a flat file which has data in the following format
Dept Emp Sal
10 50 1000
10 50 2000
10 50 2000
10 20 3000
10 20 3000
10 20 4000
I am interested in picking up the employee , where sum(sal) is the highest.In the above case the expected result is
Dept Emp Sal
10 20 10000
This is how i am doing it
1) Aggregator Transformation -- Sum Sal group by Dept and Emp
Results
Dept Emp Sal
10 50 5000
10 20 10000
2) Sort Transformation - Sort the data based on sal
Results
Dept Emp Sal
10 20 10000
10 50 5000
3) Aggregator Transformation - Pick up the first record
Results
Dept Emp Sal
10 20 10000
Is there a better way of acheiving the same results .
Please help?
Sam