Databases Reference
In-Depth Information
You can attach specific labels to each subtotal by using the LABEL subclause.
The function clause can be any of a number of aggregate functions, such as SUM,
AVG, MIN, MAX, and so forth. The summary operation can occur when a column
value changes or at the end of the report.
Janice is anticipating the next request from her boss and decides to modify her
report further to provide the sum of salaries by department and across all depart-
ments specified in the report. She will need two new COMPUTE statements and a
change to the BREAK statement:
set feedback off
ttitle left 'Department Salary Report'
btitle left 'End Salary Report' skip 1 -
left 'Widgets-R-Us, Inc.'
column Dept heading 'Dept|Number'
column salary format $999,999.99
break on Dept on Report
compute sum label 'Dept Total' -
of salary on Dept
compute sum label 'All Depts' -
of salary on Report
select department_id "Dept",
last_name || ', ' || first_name "Employee",
salary "Salary" from employees
where department_id in (30,60)
order by department_id asc, salary desc;
Search WWH ::




Custom Search