title: How to use parent column inside group concat subquery in mysql?
body: <p>I am new to mysql. I want to use parent column in sub query within group concat().</p>
  
  <p>I have a following query.</p>
  
  <pre><code>select parenttable.id,
  parenttable.name,
  group_concat
  (
      case when parenttable.id=1 then
      (
      select childtable.name, from c_table childtable 
      where childtable.id=parenttable.id
      )
  
      case when parenttable.id=2 then
      (
      select childtable.name from c_table childtable 
      where childtable.id=parenttable.id
      ) 
  
      end;
  
  )
  from p_table parenttable
  </code></pre>
  
  <p>The above query shows "Unknown column parenttable.id" . Is there any solution to fix it.</p>
  
  <p>Please help me. Thanks in advance...</p>