How to: |
When you sort report rows using the BY phrase, you can restrict the sort field values to a group of high or low values. You choose the number of fields to include in the report. For example, you can choose to display only the 10 highest (or lowest) sort field values in your report by using BY HIGHEST (or LOWEST).
You can have up to five sort fields with BY HIGHEST or BY LOWEST.
BY {HIGHEST n|LOWEST n} sortfield
where:
Specifies that only the highest n sort field values are included in the report. TOP is a synonym for HIGHEST.
Specifies that only the lowest n sort field values are included in the report.
Is the name of the sort field. The sort field can be numeric or alphanumeric.
Note: HIGHEST/LOWEST n refers to the number of sort field values, not the number of report rows. If several records have the same sort field value that satisfies the HIGHEST/LOWEST n criteria, all of them are included in the report.
The following request displays the names of the employees earning the five highest salaries.
TABLE FILE EMPLOYEE PRINT LAST_NAME BY HIGHEST 5 CURR_SAL END
The output is: