View previous topic :: View next topic
|
Author |
Message |
dharmendra.rawat84
New User
Joined: 26 Oct 2010 Posts: 1 Location: Hyderabad
|
|
|
|
Hi,
I have a file having records like this mentioned below.
SYS-ID PROV-ID COUNT
111111 3333333 10
111111 4444444 20
111111 5555555 15
222222 6666666 10
222222 7777777 20
222222 8888888 15
I have a requirement like I want the out file to be as below.
I want the records in output file that has max count.
SYS-ID PROV-ID COUNT
111111 4444444 20
222222 7777777 20
Please give me some suggestions...
Regards,
Dharam |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if you know what the value of the max-count is, no problem
otherwise, sort the file prior to reading (max-count Desc). |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Or to put it more complete:
Sort on keys ASCENDING SYS-ID PROV-ID, DESCENDING COUNT and subsequently process the first record in each break of the key SYS-ID PROV-ID, and discard the rest. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, you definition of the problem is confusing.
what are the actual control breaks?
is the highest count the highest of the file?
will every sys-id have a record (regardless of prov-id)
that contains this high-count.
or do you want the sys-id/prov-id/count for every sys-id? |
|
Back to top |
|
|
|