SQL/MP Report Writer Guide

HP NonStop SQL/MP Report Writer Guide527213-001
3-1
3 Selecting Data for a Report
Before you can define a report, you must select the data by entering a SELECT
command. The report formatting commands you specify refer to columns (or print
items) specified in the select list of the SELECT command. This section provides
examples of the following techniques for selecting data:
Developing a query
°
Determining which tables contain the data
°
Selecting the column values you need
°
Setting criteria for selecting rows
°
Sorting the data
Computing values based on column values from groups of rows: averages, sums,
minimums, maximums, and counts
Selecting rows with a distinct value in a column
Using expressions to calculate report item values
Using parameters to provide different selection criteria each time you produce a
report
Preparing SELECT commands to be executed more than once
Creating views to simplify the specification of queries, save time, and make data
access and reporting easier for nontechnical users of the database
The SELECT command selects the data that will be formatted by the report formatting
commands or will be displayed or printed in the default report format. For a complete
description of the SELECT command and all language elements of SQL, see the
SQL/MP Reference Manual. For a complete description of developing queries, see the
SQL/MP Query Guide.
Developing a Query
Before you develop a query to select data, you should plan the content of the report.
Consider the following questions:
What columns of information do you need and how should the columns be
arranged?
In what order should the rows appear?
What subtotals and totals are to be calculated?
What information do you want to include in the titles and footings?
At this point, you do not have to consider the details of formatting the report. You can
enhance the format after you have generated the basic content.