title: Selecting all parents in the order of relation from hierarchical table SQL
body: <p>I've a table like this with a parent child relation in the same table</p>
  
  <pre>
  AccountID|     ParentID     |   AccountName
  ----------------------------------------------
  1       |   0       |   Root
  2       |   1       |   Child1
  3       |   1       |   Child2
  4       |   2       |   Child3
  5       |   4       |   Child1
  6       |   5       |   Child1
  7       |   6       |   Child1
  8       |   6       |   Child1
  </pre>
  
  <p>So when I send the account ID <b>7</b> I have to get the tables in the order like child,father,grandfather..  that way.. So for 7, I need to get all parets like this</p>
  
  <pre>
  AccountID
  ---------
      7
      6
      5
      4
      2
      1
  </pre>
  
  <h3>So the most important point is the order. It should be from the bottom level to its next higher then to the next...</h3>