After you select the rows to display on your report, you
can specify the way that you want to sort the rows on the report.
About this task
In this example, you sort the rows in ascending order
by department number.
Procedure
On the Specify panel, select choice
4, Sort.
The Sort panel
displays (as shown in the following figure) with choice 1, Ascending already
selected for you.Figure 1. The Sort panel
PROMPTED QUERY USERID.MYQUERY MODIFIED LINE
+--------------------------------------+
Tables: | Sort |
Q.STAFF | |
| Select the order for sorting and the |
Columns: | column you want to sort. |
NAME | |
DEPT | Order... |
SALARY | 1 1. Ascending (A-Z, 0-9) |
COMM | 2. Descending (9-0, Z-A) |
SALARY+COMM | 1 to 5 of 5 |
| Columns... |
Row Conditions: | 1. SALARY+COMM |
If COMM Is Not NULL | 2. NAME |
And SALARY+COMM Is Greater Than | 3. DEPT |
| 4. SALARY |
Sort: | 5. COMM |
> ... +--------------------------------------+
| F1=Help F7=Backward F8=Forward |
+--------------------------------------+
Leave 1 selected if you want to sort the
rows in ascending order, or type 2 to sort the rows
in descending order.
Type the number of the column that contains the data you
want to sort.
Press Enter.
The sort order that you specified
is displayed in the echo area, and the Specify panel
displays.
What to do next
Repeat these steps if you want to sort on other columns.
For example, in this query, in addition to sorting by department number,
you might also want to sort by name within department.
QMF displays
the sort order that you selected, as shown in the following figure.
Figure 2. QMF displays
the order in which rows are sorted.
PROMPTED QUERY MODIFIED LINE 1
Tables:
_ Q.STAFF
Columns:
_ NAME
_ DEPT
_ SALARY
_ COMM
_ SALARY+COMM
Row Conditions:
_ If COMM Is Not NULL
_ And SALARY+COMM Is Greater Than 17000
Sort:
_ Ascending by DEPT
_ Ascending by NAME
1=Help 2=Run 3=End 4=Show SQL 5=Change 6=Specify
7=Backward 8=Forward 9=Form 10=Insert 11=Delete 12=Report
OK, CANCEL command executed successfully.
COMMAND ===> SCROLL ===> PAGE
QMF displays
the report in the following figure when you run this query. The rows
are first sorted by department number, and then by employee name within
each department. Figure 3. The report is sorted by department number and employee name.