Database Reference
In-Depth Information
WHERE M.MUSICCD_ID <= &CDNUM
You would have to remove the CDNUM variable definition (including
output in the header) from the CDREPORT.SQL script and enable an
ACCEPT command for the variable once again. Add the following line:
ACCEPT CDNUM PROMPT 'What CD number do you want to see? '
Remove the following lines:
DEFINE CDNUM=9
UNDEFINE CDNUM
Change the following line from:
TTITLE LEFT 'Music CD # ' CDNUM -
to:
TTITLE LEFT 'Music CD'.
The query in Figure 8.21 now displays part of the result of all CDs from
1 to 9.
There is another cool trick to add to this report in the form of summary
data (subtotals) added at the break points. Summary information is added
by using the COMPUTE command. This command can only be used in
conjunction with the BREAK command. The two work together to create a
report with breaks and summaries for each break. The syntax of the COM-
PUTE command is shown in Figure 8.22.
Like the BREAK command, you should keep the COMPUTE com-
mand on a single line or add a dash or hyphen ( - ) to continue the com-
mand to another line.
Using our CDREPORT.SQL example again, let's add a count of the
number of songs on each CD to the break point between CDs. This line
can be added at the beginning of the CDREPORT.SQL script.
COMPUTE COUNT OF SONGTITLE ON CDTITLE
 
Search WWH ::




Custom Search