Share via


Printing Query Results in a Report or Label

If your report or label includes groups or you otherwise need to order the data, you can use the various clauses of the SELECT - SQL statement to get the exact results you need.

To send results to an existing report or label

  • Use the SELECT - SQL statement with a REPORT or LABEL command.

    The following example uses the GROUP BY and ORDER BY clauses as well as the REPORT FORM command:

    SELECT * ;
       FROM tastrade!customer ;
       WHERE customer.country = "Canada" ;
       GROUP BY customer.region ;
       ORDER BY customer.postal_code, customer.company_name ;
       INTO CURSOR MyCursor
    REPORT FORM MYREPORT.FRX
    

    The following example uses a LABEL FORM command:

    SELECT * ;
       FROM tastrade!customer ;
       WHERE customer.country = "Canada" ;
       GROUP BY customer.region ;
       ORDER BY customer.postal_code, customer.company_name ;
       INTO CURSOR mycursor
    LABEL FORM MYLABEL.LBX
    

While the SELECT - SQL statement is the most flexible method for populating your report or label, it is not the only method.

See Also

Populating a Form Control | Displaying Results in a Window | SELECT - SQL | Integrating Queries and Reports