title: MySQL sum from two joined tables and multiple rows - need to bring out total or all rows
body: <p>I have the following query which works fine when bringing out the total price of each order (thanks to the stackoverflow community):</p>
  
  <pre><code>SELECT sum((ordered_items.price + ordered_items.vat) * ordered_items.qty) + orders.postage_price + orders.postage_vat as total_price
  FROM orders
  JOIN ordered_items
  ON orders.id_orders = ordered_items.order_id
  GROUP BY orders.id_orders 
  </code></pre>
  
  <p>However I also want to bring out the total amount of all the orders added together. I have tried taking off the GROUP BY but this returns the wrong price. I've figured that it's adding up all the items correctly, but then only adding on one postage.</p>
  
  <ul>
  <li>ordered_items - includes all the items ordered (so there can be multiple rows) </li>
  <li>orders - includes the postage price of the order (there will only ever be one row per order here)</li>
  </ul>
  
  <p>Many thanks in advance for any help.</p>