title: oracle - sum on a subquery?
body: <p>Wonder if anyone can help me understand how to sum up the column of single column, ie a list of costs into one total cost.</p>
  
  <p>I have been looking into this, and I think I'm on the right lines in undertsanding i need to sum the query, treat it as a subquery. However I'm not having much luck - do I need to give the subquery an alias, or is it a straight case of wrapping the query in a sum?</p>
  
  <p>Here is the working query I want to sum up, all my attempts at sum left out for clarity!</p>
  
  <pre><code>SELECT TICKET_TYPE.PRICE AS TOTALSALES, RESERVATION.RESERVATION_ID,
         CINEMA.LOCATION, PERFORMANCE.PERFORMANCE_DATE
      FROM RESERVATION, TICKET, TICKET_TYPE, CINEMA, PERFORMANCE
      WHERE TICKET_TYPE.TICKET_TYPE_ID = TICKET.TICKET_TYPE_ID
        AND TICKET.RESERVATION_ID = RESERVATION.RESERVATION_ID
        AND RESERVATION.PERFORMANCE_ID = PERFORMANCE.PERFORMANCE_ID
        AND CINEMA.LOCATION = 'sometown'
        AND PERFORMANCE.PERFORMANCE_DATE = to_date('01/03/2009','DD/MM/yyyy');
  </code></pre>
  
  <p>some of the data...</p>
  
  <pre><code>TOTALSALES RESERVATION_ID LOCATION PERFORMANCE_DATE
      2.8     1     sometown     01-MAR-09
      3.5     2     sometown     01-MAR-09
      2.8     3     sometown     01-MAR-09
      2.8     3     sometown     01-MAR-09
      2.8     3     sometown     01-MAR-09
      2       4     sometown     01-MAR-09
      2.8     5     sometown     01-MAR-09 
  </code></pre>
  
  <p>Thanks !</p>