title: Using variables when getting all parent nodes recursively
body: <p>I try getting all parent categories for each category in select using the following query:</p>
  
  <pre><code>select @c := c.id_category,c.id_parent,
  (SELECT 
        GROUP_CONCAT( @r := (
          SELECT  c1.id_parent
          FROM    ps_category c1 
          WHERE   c1.id_category = @r
          )) AS parent
  
  FROM    (
          SELECT  @r := @c
          ) vars,
          ps_category  c2
          where @r&lt;&gt;0)  p
  from   ps_category  c
  join (select @c:=0) tmp
  </code></pre>
  
  <p>I expect to get something like this:<code>
  id_category_id; id_parent; p 
  1; 0; 0
  2; 1; 1,0
  3; 1; 1,0
  4; 2; 2,1,0
  ...</code>
  but it seems that something not working with initialisation of <code>@r</code> with <code>@c</code> , what I'm doing wrong? </p>