title: MySQL hierarchical parent child id
body: <p>help me
  i'm have probelme with hirerarchi graph. i have table mysql like this :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>+------+------+-------+
  + from +  to  + value +
  +------+------+-------+
  +   1  +   2  +    2  +
  +   1  +   3  +    3  +
  +   1  +   4  +    4  +
  +   2  +   5  +    5  +
  +   2  +   6  +    4  +
  +   3  +   5  +    3  +
  +   4  +   7  +    2  +
  +   5  +   7  +    1  +
  +   6  +   7  +    2  +
  +------+------+-------+</code></pre>
  </div>
  </div>
  </p>
  
  <p>and i'm want to show query like this :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>+-------+----------+------------+
  + node1 + 1,2,6,7  + sum(value) +
  +-------+----------+------------+
  + node2 + 1,2,5,7  + sum(value) +
  +-------+----------+------------+
  + node3 + 1,3,5,7  + sum(value) +
  +-------+----------+------------+
  + node4 + 1,4,7    + sum(value) +
  +-------+----------+------------+</code></pre>
  </div>
  </div>
  </p>
  
  <p>i hope anyone can help me with query mysql or mysql procedure. please :(</p>