title: How to use sum() within a group_concat()?
body: <p>Question revised</p>
  
  <h2>Really wanted a group_concat of sums...</h2>
  
  <p>Table: shops</p>
  
  <pre><code>+---------+--------+--------+
  | shop_id | name   | state  |
  +---------+--------+--------+
  |    0    | shop 0 |    5   |
  |    1    | shop 1 |    5   |
  |    2    | shop 2 |    5   |
  |    3    | shop 3 |    2   |
  +---------+--------+--------+
  </code></pre>
  
  <p>Table: items</p>
  
  <pre><code>+------------+--------------+
  |   shop  | item | quantity | 
  +------------+--------------+
  |    0    |  0   |    1     |
  |    0    |  1   |    2     |
  |    0    |  2   |    3     |
  |    1    |  0   |    1     |
  |    1    |  1   |    2     |
  |    1    |  2   |    3     |
  |    2    |  0   |    1     |
  |    2    |  1   |    2     |
  |    2    |  2   |    3     |
  |    3    |  0   |    1     |
  |    3    |  1   |    2     |
  |    3    |  2   |    3     |
  +------------+--------------+
  
      SELECT state,SUM(i.quantity) total
      FROM shops s2
      LEFT JOIN items i ON i.shop=s2.shopid
      WHERE state=5
      GROUP by item
  
  result #1:
  
  +--------+---------+
  | state  |  total  |
  +--------+---------+
  |    5   |    3    |
  +--------+---------+
  |    5   |    6    |
  +--------+---------+
  |    5   |    9    |
  +--------+---------+
  
  But I would like the totals, like this:
  result #2:
  +--------+---------+---------+----------+
  | state  | total 0 | total 1 |  total 2 |
  +--------+---------+---------+----------+
  |    5   |    3    |     6   |    9     |
  +--------+---------+---------+----------+
  
  or using group_concat()
  result #3
  
  +--------+---------+
  | state  | totals  |
  +--------+---------+
  |    5   |  3,6,9  |
  +--------+---------+
  </code></pre>
  
  <p>I cannot seem to get group_concat to grab the total column in result #1 </p>
  
  <p>Thanks in advance</p>