title: Get category tree by path and sort order
body: <p>My category structure is shown below. My purpose is to get category structure with single query.
  I sort my table by path and I get category tree.</p>
  
  <p><strong>sort_order</strong> : Indicates sort order between categories with same level</p>
  
  <p><img src="https://i.stack.imgur.com/FQWmm.png" alt="enter image description here"></p>
  
  <p>When I run query </p>
  
  <pre><code>SELECT * FROM category order by path;
  </code></pre>
  
  <p><strong>RESULT:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/ek1kA.png" alt="enter image description here"></p>
  
  <p><strong>But result must be as shown below</strong>  because sort_order of Electronic is 1 and this is less than sort_order value of Computer category 2</p>
  
  <pre><code> - ELectronic 
   - - TV 
   - - - LCD 
   - - - - LED LCD 
   - Computer 
   - - Laptop
  </code></pre>