title: Combine sql rows with same id, sum and update the total
body: <p>I am attempting to write a php script to compare rows from the database and then adds the quantities it the product id matches. Based on cusotmer_id</p>
  
  <p>Example:</p>
  
  <p>mydb.cart</p>
  
  <pre><code>id, customer_id, cart_id, product_id, qty, price
  
  1, 0001000, 4545453, 20, 10, 12.99
  2, 0001000, 7473432, 20, 2, 12.99
  
  Result
  3, 0001000, 7473432, 20, 12, 25.98
  </code></pre>
  
  <p>trying to merge cart information from a previous session.</p>
  
  <p>Any suggestions is appreciated,</p>
  
  <p>Thanks</p>