title: Self-join with nested select query in T-SQL
body: <p>Is it possible to join a nested select statement with itself (without writing it out twice and running it twice)</p>
  
  <p>Something like this would be ideal</p>
  
  <pre><code>SELECT P.Child, P.Parent, Q.Parent AS GrandParent
  FROM (SELECT Child, Parent FROM something-complex) AS P
  LEFT JOIN P AS Q ON Q.Child = P.Parent
  </code></pre>