title: group_concat and frequency of each word in this record
body: <p>This is my database.</p>
  
  <p>Tables:</p>
  
  <pre><code>item: item_id, name
  order: order_id
  orderform: order_id, item_id, quantity
  </code></pre>
  
  <p>Data in tables</p>
  
  <pre><code>item_id  name
  1        ball
  2        cap
  3        bat
  
  order_id
  1
  2
  3
  4
  
  order_id item_id quantity
  1        1       2
  1        3       4
  2        1       1
  3        2       3
  3        1       2
  3        3       1
  4        1       2
  </code></pre>
  
  <p>At the moment I'm using following sql query:</p>
  
  <pre><code>SELECT order_id, group_concat(name)
  FROM order
  LEFT JOIN orderform
    ON order.order_id = orderform.order__id
  LEFT JOIN item
    ON orderform.item_id = item.item_id
  GROUP BY order.order_id
  </code></pre>
  
  <p>Which gives me this look</p>
  
  <pre><code>order_id         name    
  1                ball,ball,bat,bat,bat,bat
  2                ball
  3                cap,cap,cap,ball,ball,bat
  4                ball,ball
  </code></pre>
  
  <p>But I want it to look like this</p>
  
  <pre><code>order_id  name
  1         2 x ball,4 x bat
  2         ball
  3         3 x cap,2 x ball,bat
  4         2 x ball
  </code></pre>