You can use different aggregates in the same statement by including more than one compute clause. The following query is similar to the preceding one but adds the sum of the prices of psychology books by publisher:
select type, pub_id, price from titles where type = "psychology" order by type, pub_id, price compute sum(price) by type, pub_id compute sum(price) by type
type pub_id price ----------- ------- -------------- psychology 0736 7.00 psychology 0736 7.99 psychology 0736 10.95 psychology 0736 19.99 Compute Result: --------------- 45.93 type pub_id price ---------- ------- -------------- psychology 0877 21.59 Compute Result: --------------- 21.59 Compute Result: --------------- 67.52 (8 rows affected)