SQL/MP Report Writer Guide

Selecting Data for a Report
HP NonStop SQL/MP Report Writer Guide527213-001
3-36
Developing Multistep Queries
3. Select the information for the report. Include an expression in the select list to
compute the percent of the department average:
>> SELECT E.DEPTNUM, EMPNUM, LAST_NAME, SALARY,
+> SALARY/AVGSAL*100.00
+> FROM PERSNL.EMPLOYEE E, TEMPTABS.AVGTEMP A
+> WHERE E.DEPTNUM = A.DEPTNUM;
S> DETAIL DEPTNUM, EMPNUM, LAST_NAME,
+> SALARY AS F10.2,
+> COL 5 AS F10.2 HEADING "PCT OF AVG";
S> LIST ALL;
DEPTNUM EMPNUM LAST_NAME SALARY PCT OF AVG
------- ------ ---------------- ---------- ----------
1000 23 HOWARD 137000.10 263.46
1000 202 CLARK 25000.75 48.08
1000 208 CRAMER 19000.00 36.54
. . . . .
. . . . .
. . . . .
9000 1 GREEN 175500.00 165.00
9000 337 CLARK 37000.00 34.82
--- 57 row(s) selected.
>>
You can drop the temporary table or purge the data and keep the table for use in
producing future reports.