title: MySQL Statement to joins 2 tables and sum same items qty
body: <p>I have 2 tables, customer and transaction.</p>
  
  <pre><code>Customer:
  --------------------------------------------
  ID | Name            | Tel
  --------------------------------------------
  1  | Peter           | 123 4567
  2  | John            | 456 1234
  3  | Alice           | 789 4561
  4  | Amy             | 741 8525
  
  Transaction:
  --------------------------------------------
  CustID | Books | Pens  | Ruler
  --------------------------------------------
    1    |   2   |  0    |   1
    2    |   1   |  0    |   0
    1    |   0   |  3    |   0
    1    |   0   |  0    |   1
    2    |   1   |  1    |   1
    3    |   0   |  2    |   2
  </code></pre>
  
  <p>I need the following </p>
  
  <pre><code>Results:
  -------------------------------------------------------------------
  ID | Name          | Tel            | Books | Pens  | Ruler
  -------------------------------------------------------------------
  1  | Peter         | 123 4567       |   2   |   3   |   2
  2  | John          | 456 1234       |   2   |   1   |   1
  3  | Alice         | 789 4561       |   0   |   2   |   2
  4  | Amy           | 741 8525       |   0   |   0   |   0
  </code></pre>
  
  <p>Basically it will sum the Books, Pens and Ruler of the same Customer.</p>
  
  <p>I've tried:</p>
  
  <pre><code>                        $sql = "select 
                                      `customer`.id,
                                      `custmaster`.name,
                                      `custmaster`.tel,
                                      `transaction`.id,
                                      `transaction`.books,
                                      `transaction`.pens,
                                      `transaction`.ruler,
                                  from `customer` 
                                  left join `transaction` 
                                  on `customer`.id=`transaction`.custid 
                                  ORDER BY `customer`.id ASC";
  </code></pre>
  
  <p>But display none. :( I do understand that I needed the sum() function somewhere. Anybody can help?</p>