title: CTE for parent child relation with multiple parent
body: <p>I have a parent child relation table as shown below. I want to retrieve all records for a parent or child ID like all ancestors and parents and if possible with depth.
  For example I want to find the family of D, it will return the first 14 rows as all are of same family.
  There may be several set of such family. I want to query with one member and want to get whole family record. Is it possible to implement this using <strong>CTE</strong>?
  The family structures as per table record :</p>
  
  <pre><code>                      A
                       / \
                      B   C   G   J
                     /     \ / \ / \
                M   D       E   H   K
               / \ /             \ / \
              N   F               I   L
  
  
                   R
                   |
                   S   U
                    \ /
                     T
  </code></pre>
  
  <p>Please help.
  The table is like:</p>
  
  <pre><code>   Parent   Child
      ------  ------
      A            B
      A            C
      B            D
      D            F
      M            F
      M            N
      C            E
      G            E
      G            H
      J            H
      J            K
      H            I
      K            I
      K            L
      R            S
      S            T
      U            T
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Himadri</p>