How to get the 'N' th max value from the series of records

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
siva7143
Participant
Posts: 35
Joined: Wed Aug 09, 2006 12:20 am

How to get the 'N' th max value from the series of records

Post by siva7143 »

Hi,

Suppose you have 100 records with different salary values from source.

I need to get the Nth max value from 100 records.

Example:

I need to load only the 5th maximum salary value alone into the target table.

How can we achieve this?

Thanks in Advance,
Siva Kumar N :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Execute in sequential mode (or use a server job). Sort in descending order. Count the rows. Pass only the fifth row.
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