title: Sum on a left join SQL
body: <p>I have two tables I wish to join on lets say table a and table b.  Table b has many rows to table a's, table b contains prices (effectively a shopping basket).  So what I want is all records from table a and the sum of the price from table b.  I have tried</p>
  
  <pre><code>select a.*, sum(b.ach_sell) from bookings a 
  left join pricing_line b on b.bookings = a.id
  </code></pre>
  
  <p>However this obviously doesn't do as I wish, it ends up with the total sum of all ach_sell (so one record is returned).  Would someone kindly offer me a solution which would help? right now I am doing it programatically and I am pretty sure it could be done in SQL?</p>