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
Devendrudu
Participant
Posts: 31 Joined: Tue May 24, 2011 12:16 am
Post
by Devendrudu » Wed Jun 01, 2011 7:15 am
Hi Friends,
i have two files
f1 have cust_id,Tran_id,sales_amount
f2 have cust_id,cust_name
i want o/p like cust_name, Total_sales_amount
I want only top 5 Total_sales_amount customers.
how can do this?
Devendra,Bangalore,India
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jun 01, 2011 7:26 am
Join the two, sort the result by the amount descending and constrain the output to the first five records. Note you'll need to run sequentially or on one node for this to work properly.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Devendrudu
Participant
Posts: 31 Joined: Tue May 24, 2011 12:16 am
Post
by Devendrudu » Wed Jun 01, 2011 12:42 pm
if it run in 2node or 4node how will get top 5 sums
Devendra,Bangalore,India
soumya5891
Participant
Posts: 152 Joined: Mon Mar 07, 2011 6:16 am
Post
by soumya5891 » Wed Jun 01, 2011 1:02 pm
In the sort stage you need to perform a hash partioning properly
Soumya
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jun 01, 2011 1:02 pm
You'll get the Top 5 sums per node unless you throttle things down to sequential execution, hence my suggestion.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Devendrudu
Participant
Posts: 31 Joined: Tue May 24, 2011 12:16 am
Post
by Devendrudu » Wed Jun 01, 2011 1:07 pm
which key i want to hash partition.
Devendra,Bangalore,India
DSguru2B
Charter Member
Posts: 6854 Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX
Post
by DSguru2B » Wed Jun 01, 2011 1:16 pm
The answer lies in this statement
Devendrudu wrote:
I want only top 5 Total_sales_amount customers.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.