title: SQL - Creating tree from parent and child columns
body: <p>I'm having some trouble figuring out how to create a table showing all the relations of a child column with its subsequent parent columns. I am using SQL in Teradata SQL Assistant.</p>
  
  <p>For example, here is the data I have:</p>
  
  <pre>
  Parent | Child                               
  A      | B                                                     
  A      | C         
  B      | D           
  E      | E
  </pre>
  
  <p>I want to be able to get an output table, showing the lowest level child element with all its subsequent parent elements as follows:</p>
  
  <pre>
  Child | ParentL1 | Parent L2        
  C     | A       
  D     | B        | A       
  E
  </pre>
  
  <p>Thing is, I do not know how many levels of parents exists in my data, and I am allowed access only to querying data, so I am unable to create new tables, alter this table, or change any values.</p>
  
  <p>Is there any way to get the expected output in a query?</p>
  
  <p>Thank you!</p>