title: SQL with Count and SUM functions on 2 tables assistance
body: <p>I have a basic table named customer:</p>
  
  <pre><code>CustId Name
  AB1    George Arkin
  AB2    Indiana James
  AB3    Michael Anjelo
  </code></pre>
  
  <p>and another table named booking:</p>
  
  <pre><code>CustId FlightId Price
  AB1    FL134    43.00 
  AB1    FL122    21.00
  AB1    FL134    49.00
  AB1    FL122    48.00  
  AB2    FL291    40.00  
  AB2    FL291    29.00  
  AB2    FL293    22.00  
  AB2    FL862    56.00  
  AB2    FL862    12.00  
  AB2    FL293    99.00  
  AB3    FL900    100.00  
  </code></pre>
  
  <p>Now what I'd like to do is join both tables. I would then like to calculate how many flights a single person has booked (displaying all persons) and I would also like for each person the have a total price next to it adding up the total of each price they have paid. So far I came up with this:</p>
  
  <pre><code>SELECT C.CustId, C.Name, COUNT(DISTINCT B.FlightId) AS "NumberOfTicketsPurchased"
  ,      SUM(DISTINCT B.Price) AS "TotalPrice"
  FROM customer C, booking B
  </code></pre>
  
  <p>But I only get one result and the total price and count is not accurate.</p>
  
  <p>P.S this is an example table for something I am practising in my own time to prepare for Data Management next Semester.</p>