title: Recursive hierarchical query in SQL
body: <p>I have below table</p>
  
  <p>TblMatrix</p>
  
  <pre><code>ID   ApproverId
  --------------------
  1    4
  2    7
  7    8
  4    5
  5    6
  </code></pre>
  
  <p>I want to write a self join query to return below output for any ApproverId</p>
  
  <p>If I pass ApproverId As 6</p>
  
  <p>Output should be</p>
  
  <pre><code>ID
  ---
  5
  4
  1
  </code></pre>
  
  <p>If I pass ApproverId As 8</p>
  
  <p>Output should be</p>
  
  <pre><code>ID
  ---
  7
  2
  </code></pre>