title: MySQL GROUP_CONCAT from subquery
body: <p>I'm trying to get a concat list from every row in an outer query but I get <code>Unknown column 'outter_client' in 'where clause'</code> elsewhere I saw that you can't access an outer variable from a subquery, is there a way to reformulate this query without stored procedures, views or temporary tables and get it working?</p>
  
  <pre><code>SELECT client AS outer_client, top_domain
  FROM log
  JOIN (
     SELECT GROUP_CONCAT(t.domain) AS top_domain 
     FROM (
        SELECT domain 
        FROM log
        WHERE client = outer_client 
        GROUP BY 1 
        ORDER BY SUM(bytes)
        LIMIT 5
     ) t
  ) k
  GROUP BY client
  ORDER BY SUM(bytes)
  LIMIT 5;
  </code></pre>