title: Get the SUM of a string field in MySQL
body: <p>I have this example MySQL table below:</p>
  
  <pre><code>date      |name    |invoice | quantity  | 
  -------------------------------
  2012-10-02 01:00|aaaa   |101 |  1
  2012-10-02 01:30|aaaa   |102 |  2  
  2012-10-02 01:45|aaaa   |102 |  3  
  </code></pre>
  
  <p>I want to <code>GROUP BY</code> date and get a similar results:</p>
  
  <pre><code>date      |  name    |invoice | freq_name | freq_quantity  | 
  --------------------------------------------------
  2012-10-02|  aaaa    |101     |1          | 1
  2012-10-02|  aaaa    |102     |2          | 5
  </code></pre>
  
  <p>I have tried to perform this aggregation like below:</p>
  
  <pre><code>SELECT 
  date, 
  name, 
  invoice, 
  SUM(quantity) AS freq_quantity, 
  SUM(name) AS freq_name
  FROM table
  GROUP BY date, name, invoice
  </code></pre>
  
  <p>The <code>freq_quantity</code> field is correct, while the <code>freq_name</code> string field not.</p>