Using QMF


Creating a report containing a limited number of ordered entries

You can create a report that contains a limited number of ordered entries. To do so, first construct a SQL query that selects and orders entries as appropriate to your objective. Then, run the query and specify the row limit value that gives the desired result. The key elements are the ORDER BY clause of the SQL statement, and the ROWLIMIT parameter of the RUN QUERY command. For example, to create a report that contains the five managers with the most years of service, you could use the following query and QMF command.

SQL query:

SELECT NAME, YEARS
  FROM Q.STAFF
 WHERE JOB='MGR'
 ORDER BY YEARS DESC

QMF command:

RUN QUERY (ROWLIMIT=5

Resulting report:

NAME        YEARS
---------  ------
JONES          12
QUILL          10
HANES          10
LU             10
LEA             9


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