title: SQL Calculations on 3 Table Inner Join
body: <p>I have three tables: Stock, Orderline and Order. I have a Total column in the Order table which I want to contain a sum of the orderlines for each order. The Orderline table consists of Order_id, Stock_id and Qty, the Stock table has Stock_id and Price. I can filter the Stock_ids associated with each Order_id and display the Qty for each, and I think I need to use an inner join to calculate the cost of each order through summing the price of each Stock_id and multiplying it by both the Qty in the Orderline table and the price in the Stock table, but I'm not sure where to start with this. I also want to have this added to the Total column within the database when calculated for each Order_id and don't know how to do that either. I'm using SQLite3. Any help would be greatly appreciated.</p>
  
  <p>Order Table:
  order_id, order_total, order_datetime</p>
  
  <p>Orderline Table:
  order_id, stock_id, qty</p>
  
  <p>Stock Table:
  stock_id, stock_price, stock_name</p>