title: How do I compute the sum of a count column in Oracle SQL?
body: <p>I am trying to compute the sum of a column which counts values of another number column. The specific column I want to compute the sum of is 'COUNT(d.totalcostofrent).</p>
  
  <p>I just can't get the sum to show up under the table at all!</p>
  
  <p>Here is my code:</p>
  
  <pre><code>COLUMN dummy NOPRINT
  COMPUTE SUM OF totalcostofrent ON DUMMY
  BREAK ON dummy
  COLUMN branchname HEADING 'Branch Name'
  COLUMN "Revenue" HEADING 'Rental Revenue' FORMAT $99,999
  
  select null dummy,
         a.branchname,
         count(c.rentalid) "Number of Rentals",
         SUM(d.totalcostofrent) "Revenue"
  from   branch a
   inner join branchstaffrole b on a.branchid = b.branchid
   inner join rental c on b.staffid = c.branchstaffid
   inner join rentaltool d on c.rentalid = d.rentalid
  where  to_char(d.DATEOUT, 'YYYY') = '&amp;Year'
  group  by a.branchname
  order  by 4 DESC;
  
  
  Branch Name          Number of Rentals Rental Revenue
  -------------------- ----------------- --------------
  Lichfield                            2           $120
  Stoke-on-Trent                       3           $140
  Birmingham                           3           $155
  Stafford                             3           $225
  </code></pre>
  
  <p>I would like it to look like this:</p>
  
  <pre><code>Branch Name          Number of Rentals Rental Revenue
  -------------------- ----------------- --------------
  Lichfield                            2           $120
  Stoke-on-Trent                       3           $140
  Birmingham                           3           $155
  Stafford                             3           $225
                                                   ____
  Sum                                              $640
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated! </p>