title: Joining a Quotation, Orders and Customer Table?
body: <p>I have 3 tables I would like to join to output a single row detailing the quotation number, customer name and order totals.. </p>
  
  <p>TBL_QUOTATIONS</p>
  
  <pre><code>quotation_id     |   customer_id   |    status     
  -----------------+-----------------+---------------
  1038                 21                 Open
  1039                 22                 Open     
  </code></pre>
  
  <p>TBL_CUSTOMERS</p>
  
  <pre><code>customer_id      |   name          |    status     
  -----------------+-----------------+---------------
  21                  David               Active 
  22                  Alvin               Active      
  </code></pre>
  
  <p>TBL_ORDERS</p>
  
  <pre><code>order_id     |   quote_id   |    desc             |    amount   
  -------------+--------------+---------------------+-------------
  1                 1038          Consultation           1500
  2                 1038          Design Fees            1200
  3                 1038          Misc Fees               500
  </code></pre>
  
  <p>Would need help to get the statement to do the above correctly... Currently I am using </p>
  
  <p>SELECT tbl_quotations.quote_id, customers.customer_id, name, sum(amount) 
  FROM tbl_quotations INNER JOIN customers ON tbl_quotations.customer_id = tbl_customers.customer_id
  Join orders ON tbl_quotations.quote_id = tbl_orders.quote_id</p>
  
  <p>RESULT</p>
  
  <pre><code>quote_id     |   customer_name   |    sum(amount)             
  -------------+-------------------+-------------------
  1038              David              3200            
  1039              Alvin                 0
   .                 .                   .
   .                 .                   .
   .                 .                   .
  </code></pre>
  
  <p>I am not sure where i went wrong but apparently the statement is only returning one row even if you had more quotes in the database.</p>
  
  <p>Any help or advice on where I went wrong? Is my approach even appropriate?
  Thank you!</p>