title: Reasons not to use GROUP_CONCAT?
body: <p>I just discovered this amazingly useful MySQL function <code>GROUP_CONCAT</code>. It appears so useful and over-simplifying for me that I'm actually afraid of using it. Mainly because it's been quite some time since I started in web-programming and I've never seen it anywhere. A sample of awesome usage would be the following</p>
  <p>Table <code>clients</code> holds clients ( you don't say... ) one row per client with unique IDs.<br />
  Table <code>currencies</code> has 3 columns <code>client_id</code>, <code>currency</code> and <code>amount</code>.</p>
  <p>Now if I wanted to get user 15's <code>name</code> from the <code>clients</code> table and his balances, with the &quot;old&quot; method of array overwriting I would have to do use the following SQL</p>
  <pre><code>SELECT id, name, currency, amount 
  FROM clients LEFT JOIN currencies ON clients.id = client_id 
  WHERE clients.id = 15
  </code></pre>
  <p>Then in php I would have to loop through the result set and do an array overwrite ( which I'm really not a big fan of, especially in massive result sets ) like</p>
  <pre><code>$result = array();
  foreach($stmt-&gt;fetchAll() as $row){
      $result[$row['id']]['name'] = $row['name'];
      $result[$row['id']]['currencies'][$row['currency']] = $row['amount'];
  }
  </code></pre>
  <p>However with the newly discovered function I can use this</p>
  <pre><code>SELECT id, name, GROUP_CONCAT(currency) as currencies GROUP_CONCAT(amount) as amounts 
  FROM clients LEFT JOIN currencies ON clients.id = client_id 
  WHERE clients.id = 15
  GROUP BY clients.id
  </code></pre>
  <p>Then on application level things are so awesome and pretty</p>
  <pre><code>$results = $stmt-&gt;fetchAll();
  foreach($results as $k =&gt; $v){
      $results[$k]['currencies'] = array_combine(explode(',', $v['currencies']), explode(',', $v['amounts']));
  }
  </code></pre>
  <p>The question I would like to ask is are there any drawbacks to using this function in performance or anything at all, because to me it just looks like pure awesomeness, which makes me think that there must be a reason for people not to be using it quite often.</p>
  <h1>EDIT:</h1>
  <p>I want to ask, eventually, what are the other options besides array overwriting to end up with a multidimensional array from a MySQL result set, because if I'm selecting 15 columns it's a really big pain in the neck to write that beast..</p>