Using QMF

Order by more than one column

To order by more than one column, put DO(1). under the column to be ordered first. Then, put DO(2). under the next most significant column, and so on.

The number following DO. is called the sort priority. The sequence of sort priorities you use need not be complete. For example, you can use 1, 2, and 4 without using 3, but no two columns can have the same priority.

The following query sorts by job first (in descending order). Then, within each job classification, it orders the rows by years of employment, beginning with the greatest number of years (descending order).

When you run this query:



Q.STAFF | NAME | DEPT | JOB       | YEARS     |
--------+------+------+-----------+-----------|
        | P.   | 84   | P. DO(1). | P. DO(2). |

QMF produces this report:

NAME       JOB    YEARS
---------  -----  -----
EDWARDS    SALES      7
DAVIS      SALES      5
QUILL      MGR       10
GAFNEY     CLERK      5

You can sort on only those columns that the query selects. If you use DO. in some row and column of an example table, you must use P. either in the same row and column, or in the same row under the table name (which displays every column).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]